Commit aba905f3 by Yiming Liu

Merge pull request #45 from lepdou/adminservice_discovery

config service test change default cluster name
parents 04eeea4f c30b9eb5
...@@ -25,6 +25,7 @@ import org.springframework.test.util.ReflectionTestUtils; ...@@ -25,6 +25,7 @@ import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import com.ctrip.apollo.Apollo.Env; import com.ctrip.apollo.Apollo.Env;
import com.ctrip.apollo.core.Constants;
import com.ctrip.apollo.core.dto.ClusterDTO; import com.ctrip.apollo.core.dto.ClusterDTO;
import com.ctrip.apollo.core.dto.ConfigItemDTO; import com.ctrip.apollo.core.dto.ConfigItemDTO;
import com.ctrip.apollo.core.dto.ReleaseSnapshotDTO; import com.ctrip.apollo.core.dto.ReleaseSnapshotDTO;
...@@ -93,7 +94,7 @@ public class ConfigServiceTest { ...@@ -93,7 +94,7 @@ public class ConfigServiceTest {
VersionDTO someVersion = assembleVersion(appId, "1.0", releaseId); VersionDTO someVersion = assembleVersion(appId, "1.0", releaseId);
ReleaseSnapshotDTO[] releaseSnapShots = new ReleaseSnapshotDTO[1]; ReleaseSnapshotDTO[] releaseSnapShots = new ReleaseSnapshotDTO[1];
releaseSnapShots[0] = assembleReleaseSnapShot(11111, "default-cluster-name", releaseSnapShots[0] = assembleReleaseSnapShot(11111, Constants.DEFAULT_CLUSTER_NAME,
"{\"6666.foo\":\"demo1\", \"6666.bar\":\"demo2\"}"); "{\"6666.foo\":\"demo1\", \"6666.bar\":\"demo2\"}");
restInvoke(serviceLocator.getAdminService(Env.DEV) + "/configs/release/" + releaseId, restInvoke(serviceLocator.getAdminService(Env.DEV) + "/configs/release/" + releaseId,
...@@ -118,7 +119,7 @@ public class ConfigServiceTest { ...@@ -118,7 +119,7 @@ public class ConfigServiceTest {
long releaseId = 11111; long releaseId = 11111;
VersionDTO someVersion = assembleVersion(appId, "1.0", releaseId); VersionDTO someVersion = assembleVersion(appId, "1.0", releaseId);
ReleaseSnapshotDTO[] releaseSnapShots = new ReleaseSnapshotDTO[1]; ReleaseSnapshotDTO[] releaseSnapShots = new ReleaseSnapshotDTO[1];
releaseSnapShots[0] = assembleReleaseSnapShot(11111, "default-cluster-name", releaseSnapShots[0] = assembleReleaseSnapShot(11111, Constants.DEFAULT_CLUSTER_NAME,
"{\"6666.foo\":\"demo1\", \"6666.bar\":\"demo2\", \"5555.bar\":\"demo2\", \"22.bar\":\"demo2\"}"); "{\"6666.foo\":\"demo1\", \"6666.bar\":\"demo2\", \"5555.bar\":\"demo2\", \"22.bar\":\"demo2\"}");
restInvoke(serviceLocator.getAdminService(Env.DEV) + "/configs/release/" + releaseId, restInvoke(serviceLocator.getAdminService(Env.DEV) + "/configs/release/" + releaseId,
...@@ -143,7 +144,7 @@ public class ConfigServiceTest { ...@@ -143,7 +144,7 @@ public class ConfigServiceTest {
long releaseId = 11111; long releaseId = 11111;
VersionDTO someVersion = assembleVersion(appId, "1.0", releaseId); VersionDTO someVersion = assembleVersion(appId, "1.0", releaseId);
ReleaseSnapshotDTO[] releaseSnapShots = new ReleaseSnapshotDTO[2]; ReleaseSnapshotDTO[] releaseSnapShots = new ReleaseSnapshotDTO[2];
releaseSnapShots[0] = assembleReleaseSnapShot(11111, "default-cluster-name", releaseSnapShots[0] = assembleReleaseSnapShot(11111, Constants.DEFAULT_CLUSTER_NAME,
"{\"6666.foo\":\"demo1\", \"6666.bar\":\"demo2\"}"); "{\"6666.foo\":\"demo1\", \"6666.bar\":\"demo2\"}");
releaseSnapShots[1] = assembleReleaseSnapShot(11112, "cluster1", releaseSnapShots[1] = assembleReleaseSnapShot(11112, "cluster1",
"{\"6666.foo\":\"demo1\", \"6666.bar\":\"demo2\"}"); "{\"6666.foo\":\"demo1\", \"6666.bar\":\"demo2\"}");
...@@ -203,7 +204,7 @@ public class ConfigServiceTest { ...@@ -203,7 +204,7 @@ public class ConfigServiceTest {
private ReleaseSnapshotDTO[] assembleReleaseSnapShots() { private ReleaseSnapshotDTO[] assembleReleaseSnapShots() {
ReleaseSnapshotDTO[] releaseSnapShots = new ReleaseSnapshotDTO[3]; ReleaseSnapshotDTO[] releaseSnapShots = new ReleaseSnapshotDTO[3];
releaseSnapShots[0] = assembleReleaseSnapShot(11111, "default-cluster-name", releaseSnapShots[0] = assembleReleaseSnapShot(11111, Constants.DEFAULT_CLUSTER_NAME,
"{\"6666.foo\":\"demo1\", \"6666.bar\":\"demo2\",\"3333.foo\":\"1008\",\"4444.bar\":\"99901\"}"); "{\"6666.foo\":\"demo1\", \"6666.bar\":\"demo2\",\"3333.foo\":\"1008\",\"4444.bar\":\"99901\"}");
releaseSnapShots[1] = assembleReleaseSnapShot(11111, "cluster1", "{\"6666.foo\":\"demo1\"}"); releaseSnapShots[1] = assembleReleaseSnapShot(11111, "cluster1", "{\"6666.foo\":\"demo1\"}");
releaseSnapShots[2] = assembleReleaseSnapShot(11111, "cluster2", "{\"6666.bar\":\"bar2222\"}"); releaseSnapShots[2] = assembleReleaseSnapShot(11111, "cluster2", "{\"6666.bar\":\"bar2222\"}");
...@@ -221,7 +222,7 @@ public class ConfigServiceTest { ...@@ -221,7 +222,7 @@ public class ConfigServiceTest {
private ClusterDTO[] assembleClusters() { private ClusterDTO[] assembleClusters() {
ClusterDTO[] clusters = new ClusterDTO[2]; ClusterDTO[] clusters = new ClusterDTO[2];
clusters[0] = assembleCluster(100, 6666, "default-cluster-name"); clusters[0] = assembleCluster(100, 6666, Constants.DEFAULT_CLUSTER_NAME);
clusters[1] = assembleCluster(101, 6666, "cluster1"); clusters[1] = assembleCluster(101, 6666, "cluster1");
return clusters; return clusters;
} }
...@@ -236,10 +237,10 @@ public class ConfigServiceTest { ...@@ -236,10 +237,10 @@ public class ConfigServiceTest {
private ConfigItemDTO[] assembleConfigItems() { private ConfigItemDTO[] assembleConfigItems() {
ConfigItemDTO[] configItems = new ConfigItemDTO[5]; ConfigItemDTO[] configItems = new ConfigItemDTO[5];
configItems[0] = assembleConfigItem(100, "default-cluster-name", 6666, "6666.k1", "6666.v1"); configItems[0] = assembleConfigItem(100, Constants.DEFAULT_CLUSTER_NAME, 6666, "6666.k1", "6666.v1");
configItems[1] = assembleConfigItem(100, "default-cluster-name", 6666, "6666.k2", "6666.v2"); configItems[1] = assembleConfigItem(100, Constants.DEFAULT_CLUSTER_NAME, 6666, "6666.k2", "6666.v2");
configItems[2] = assembleConfigItem(100, "default-cluster-name", 6666, "6666.k3", "6666.v3"); configItems[2] = assembleConfigItem(100, Constants.DEFAULT_CLUSTER_NAME, 6666, "6666.k3", "6666.v3");
configItems[3] = assembleConfigItem(100, "default-cluster-name", 5555, "5555.k1", "5555.v1"); configItems[3] = assembleConfigItem(100, Constants.DEFAULT_CLUSTER_NAME, 5555, "5555.k1", "5555.v1");
configItems[4] = assembleConfigItem(101, "cluster1", 6666, "6666.k1", "6666.v1"); configItems[4] = assembleConfigItem(101, "cluster1", 6666, "6666.k1", "6666.v1");
return configItems; return configItems;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment