Skip to content

Commit

Permalink
fixing describeDomain and updateDomain responses to include domainCon…
Browse files Browse the repository at this point in the history
…figuration and replicationConfiguration. (#739)
  • Loading branch information
mindaugasbarcauskas authored Sep 7, 2022
1 parent 51654a5 commit 5158e92
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -343,13 +343,17 @@ public static DescribeDomainResponse describeDomainResponse(
DescribeDomainResponse response = new DescribeDomainResponse();
DomainInfo domainInfo = new DomainInfo();
response.setDomainInfo(domainInfo);

domainInfo.setName(t.getDomain().getName());
domainInfo.setStatus(domainStatus(t.getDomain().getStatus()));
domainInfo.setDescription(t.getDomain().getDescription());
domainInfo.setOwnerEmail(t.getDomain().getOwnerEmail());
domainInfo.setData(t.getDomain().getDataMap());
domainInfo.setUuid(t.getDomain().getId());

DomainConfiguration domainConfiguration = new DomainConfiguration();
response.setConfiguration(domainConfiguration);

domainConfiguration.setWorkflowExecutionRetentionPeriodInDays(
durationToDays(t.getDomain().getWorkflowExecutionRetentionPeriod()));
domainConfiguration.setEmitMetric(true);
Expand All @@ -360,10 +364,14 @@ public static DescribeDomainResponse describeDomainResponse(
domainConfiguration.setVisibilityArchivalStatus(
archivalStatus(t.getDomain().getVisibilityArchivalStatus()));
domainConfiguration.setVisibilityArchivalURI(t.getDomain().getVisibilityArchivalUri());

DomainReplicationConfiguration replicationConfiguration = new DomainReplicationConfiguration();
response.setReplicationConfiguration(replicationConfiguration);

replicationConfiguration.setActiveClusterName(t.getDomain().getActiveClusterName());
replicationConfiguration.setClusters(
clusterReplicationConfigurationArray(t.getDomain().getClustersList()));

response.setFailoverVersion(t.getDomain().getFailoverVersion());
response.setIsGlobalDomain(t.getDomain().getIsGlobalDomain());
return response;
Expand Down Expand Up @@ -406,7 +414,9 @@ public static UpdateDomainResponse updateDomainResponse(
domainInfo.setOwnerEmail(t.getDomain().getOwnerEmail());
domainInfo.setData(t.getDomain().getDataMap());
domainInfo.setUuid(t.getDomain().getId());

DomainConfiguration domainConfiguration = new DomainConfiguration();
updateDomainResponse.setConfiguration(domainConfiguration);

domainConfiguration.setWorkflowExecutionRetentionPeriodInDays(
durationToDays(t.getDomain().getWorkflowExecutionRetentionPeriod()));
Expand All @@ -418,8 +428,10 @@ public static UpdateDomainResponse updateDomainResponse(
domainConfiguration.setVisibilityArchivalStatus(
archivalStatus(t.getDomain().getVisibilityArchivalStatus()));
domainConfiguration.setVisibilityArchivalURI(t.getDomain().getVisibilityArchivalUri());

DomainReplicationConfiguration domainReplicationConfiguration =
new DomainReplicationConfiguration();
updateDomainResponse.setReplicationConfiguration(domainReplicationConfiguration);

domainReplicationConfiguration.setActiveClusterName(t.getDomain().getActiveClusterName());
domainReplicationConfiguration.setClusters(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Modifications copyright (C) 2017 Uber Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. A copy of the License is
* located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

package com.uber.cadence.internal.compatibility.thrift;

import com.uber.cadence.api.v1.DescribeDomainResponse;
import com.uber.cadence.api.v1.Domain;
import com.uber.cadence.api.v1.UpdateDomainResponse;
import org.junit.Assert;
import org.junit.Test;

public class ResponseMapperTest {

@Test
public void DescribeDomainContainsConfigurationInfo() {
com.uber.cadence.api.v1.DescribeDomainResponse describeDomainResponse =
DescribeDomainResponse.newBuilder().setDomain(Domain.newBuilder().build()).build();
com.uber.cadence.DescribeDomainResponse response =
ResponseMapper.describeDomainResponse(describeDomainResponse);
Assert.assertNotNull(response.configuration);
Assert.assertNotNull(response.replicationConfiguration);
}

@Test
public void UpdateDomainContainsConfigurationInfo() {
com.uber.cadence.api.v1.UpdateDomainResponse updateDomainResponse =
UpdateDomainResponse.newBuilder().setDomain(Domain.newBuilder().build()).build();

com.uber.cadence.UpdateDomainResponse response =
ResponseMapper.updateDomainResponse(updateDomainResponse);

Assert.assertNotNull(response.configuration);
Assert.assertNotNull(response.replicationConfiguration);
}
}

0 comments on commit 5158e92

Please sign in to comment.