Skip to content

Commit 5158e92

Browse files
fixing describeDomain and updateDomain responses to include domainConfiguration and replicationConfiguration. (#739)
1 parent 51654a5 commit 5158e92

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed

src/main/java/com/uber/cadence/internal/compatibility/thrift/ResponseMapper.java

+12
Original file line numberDiff line numberDiff line change
@@ -343,13 +343,17 @@ public static DescribeDomainResponse describeDomainResponse(
343343
DescribeDomainResponse response = new DescribeDomainResponse();
344344
DomainInfo domainInfo = new DomainInfo();
345345
response.setDomainInfo(domainInfo);
346+
346347
domainInfo.setName(t.getDomain().getName());
347348
domainInfo.setStatus(domainStatus(t.getDomain().getStatus()));
348349
domainInfo.setDescription(t.getDomain().getDescription());
349350
domainInfo.setOwnerEmail(t.getDomain().getOwnerEmail());
350351
domainInfo.setData(t.getDomain().getDataMap());
351352
domainInfo.setUuid(t.getDomain().getId());
353+
352354
DomainConfiguration domainConfiguration = new DomainConfiguration();
355+
response.setConfiguration(domainConfiguration);
356+
353357
domainConfiguration.setWorkflowExecutionRetentionPeriodInDays(
354358
durationToDays(t.getDomain().getWorkflowExecutionRetentionPeriod()));
355359
domainConfiguration.setEmitMetric(true);
@@ -360,10 +364,14 @@ public static DescribeDomainResponse describeDomainResponse(
360364
domainConfiguration.setVisibilityArchivalStatus(
361365
archivalStatus(t.getDomain().getVisibilityArchivalStatus()));
362366
domainConfiguration.setVisibilityArchivalURI(t.getDomain().getVisibilityArchivalUri());
367+
363368
DomainReplicationConfiguration replicationConfiguration = new DomainReplicationConfiguration();
369+
response.setReplicationConfiguration(replicationConfiguration);
370+
364371
replicationConfiguration.setActiveClusterName(t.getDomain().getActiveClusterName());
365372
replicationConfiguration.setClusters(
366373
clusterReplicationConfigurationArray(t.getDomain().getClustersList()));
374+
367375
response.setFailoverVersion(t.getDomain().getFailoverVersion());
368376
response.setIsGlobalDomain(t.getDomain().getIsGlobalDomain());
369377
return response;
@@ -406,7 +414,9 @@ public static UpdateDomainResponse updateDomainResponse(
406414
domainInfo.setOwnerEmail(t.getDomain().getOwnerEmail());
407415
domainInfo.setData(t.getDomain().getDataMap());
408416
domainInfo.setUuid(t.getDomain().getId());
417+
409418
DomainConfiguration domainConfiguration = new DomainConfiguration();
419+
updateDomainResponse.setConfiguration(domainConfiguration);
410420

411421
domainConfiguration.setWorkflowExecutionRetentionPeriodInDays(
412422
durationToDays(t.getDomain().getWorkflowExecutionRetentionPeriod()));
@@ -418,8 +428,10 @@ public static UpdateDomainResponse updateDomainResponse(
418428
domainConfiguration.setVisibilityArchivalStatus(
419429
archivalStatus(t.getDomain().getVisibilityArchivalStatus()));
420430
domainConfiguration.setVisibilityArchivalURI(t.getDomain().getVisibilityArchivalUri());
431+
421432
DomainReplicationConfiguration domainReplicationConfiguration =
422433
new DomainReplicationConfiguration();
434+
updateDomainResponse.setReplicationConfiguration(domainReplicationConfiguration);
423435

424436
domainReplicationConfiguration.setActiveClusterName(t.getDomain().getActiveClusterName());
425437
domainReplicationConfiguration.setClusters(
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Modifications copyright (C) 2017 Uber Technologies, Inc.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
7+
* use this file except in compliance with the License. A copy of the License is
8+
* located at
9+
*
10+
* http://aws.amazon.com/apache2.0
11+
*
12+
* or in the "license" file accompanying this file. This file is distributed on
13+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14+
* express or implied. See the License for the specific language governing
15+
* permissions and limitations under the License.
16+
*/
17+
18+
package com.uber.cadence.internal.compatibility.thrift;
19+
20+
import com.uber.cadence.api.v1.DescribeDomainResponse;
21+
import com.uber.cadence.api.v1.Domain;
22+
import com.uber.cadence.api.v1.UpdateDomainResponse;
23+
import org.junit.Assert;
24+
import org.junit.Test;
25+
26+
public class ResponseMapperTest {
27+
28+
@Test
29+
public void DescribeDomainContainsConfigurationInfo() {
30+
com.uber.cadence.api.v1.DescribeDomainResponse describeDomainResponse =
31+
DescribeDomainResponse.newBuilder().setDomain(Domain.newBuilder().build()).build();
32+
com.uber.cadence.DescribeDomainResponse response =
33+
ResponseMapper.describeDomainResponse(describeDomainResponse);
34+
Assert.assertNotNull(response.configuration);
35+
Assert.assertNotNull(response.replicationConfiguration);
36+
}
37+
38+
@Test
39+
public void UpdateDomainContainsConfigurationInfo() {
40+
com.uber.cadence.api.v1.UpdateDomainResponse updateDomainResponse =
41+
UpdateDomainResponse.newBuilder().setDomain(Domain.newBuilder().build()).build();
42+
43+
com.uber.cadence.UpdateDomainResponse response =
44+
ResponseMapper.updateDomainResponse(updateDomainResponse);
45+
46+
Assert.assertNotNull(response.configuration);
47+
Assert.assertNotNull(response.replicationConfiguration);
48+
}
49+
}

0 commit comments

Comments
 (0)