|
@@ -94,7 +94,7 @@ public abstract class FederationStateStoreBaseTest {
|
|
|
@Test
|
|
|
public void testDeregisterSubCluster() throws Exception {
|
|
|
SubClusterId subClusterId = SubClusterId.newInstance("SC");
|
|
|
- registerSubCluster(subClusterId);
|
|
|
+ registerSubCluster(createSubClusterInfo(subClusterId));
|
|
|
|
|
|
SubClusterDeregisterRequest deregisterRequest = SubClusterDeregisterRequest
|
|
|
.newInstance(subClusterId, SubClusterState.SC_UNREGISTERED);
|
|
@@ -124,7 +124,7 @@ public abstract class FederationStateStoreBaseTest {
|
|
|
|
|
|
SubClusterId subClusterId = SubClusterId.newInstance("SC");
|
|
|
SubClusterInfo subClusterInfo = createSubClusterInfo(subClusterId);
|
|
|
- registerSubCluster(subClusterId);
|
|
|
+ registerSubCluster(subClusterInfo);
|
|
|
|
|
|
GetSubClusterInfoRequest request =
|
|
|
GetSubClusterInfoRequest.newInstance(subClusterId);
|
|
@@ -184,10 +184,10 @@ public abstract class FederationStateStoreBaseTest {
|
|
|
@Test
|
|
|
public void testSubClusterHeartbeat() throws Exception {
|
|
|
SubClusterId subClusterId = SubClusterId.newInstance("SC");
|
|
|
- registerSubCluster(subClusterId);
|
|
|
+ registerSubCluster(createSubClusterInfo(subClusterId));
|
|
|
|
|
|
SubClusterHeartbeatRequest heartbeatRequest = SubClusterHeartbeatRequest
|
|
|
- .newInstance(subClusterId, SubClusterState.SC_RUNNING, "cabability");
|
|
|
+ .newInstance(subClusterId, SubClusterState.SC_RUNNING, "capability");
|
|
|
stateStore.subClusterHeartbeat(heartbeatRequest);
|
|
|
|
|
|
Assert.assertEquals(SubClusterState.SC_RUNNING,
|
|
@@ -199,7 +199,7 @@ public abstract class FederationStateStoreBaseTest {
|
|
|
public void testSubClusterHeartbeatUnknownSubCluster() throws Exception {
|
|
|
SubClusterId subClusterId = SubClusterId.newInstance("SC");
|
|
|
SubClusterHeartbeatRequest heartbeatRequest = SubClusterHeartbeatRequest
|
|
|
- .newInstance(subClusterId, SubClusterState.SC_RUNNING, "cabability");
|
|
|
+ .newInstance(subClusterId, SubClusterState.SC_RUNNING, "capability");
|
|
|
|
|
|
try {
|
|
|
stateStore.subClusterHeartbeat(heartbeatRequest);
|
|
@@ -213,7 +213,7 @@ public abstract class FederationStateStoreBaseTest {
|
|
|
// Test FederationApplicationHomeSubClusterStore
|
|
|
|
|
|
@Test
|
|
|
- public void testAddApplicationHomeSubClusterMap() throws Exception {
|
|
|
+ public void testAddApplicationHomeSubCluster() throws Exception {
|
|
|
ApplicationId appId = ApplicationId.newInstance(1, 1);
|
|
|
SubClusterId subClusterId = SubClusterId.newInstance("SC");
|
|
|
ApplicationHomeSubCluster ahsc =
|
|
@@ -222,15 +222,15 @@ public abstract class FederationStateStoreBaseTest {
|
|
|
AddApplicationHomeSubClusterRequest request =
|
|
|
AddApplicationHomeSubClusterRequest.newInstance(ahsc);
|
|
|
AddApplicationHomeSubClusterResponse response =
|
|
|
- stateStore.addApplicationHomeSubClusterMap(request);
|
|
|
+ stateStore.addApplicationHomeSubCluster(request);
|
|
|
|
|
|
- Assert.assertNotNull(response);
|
|
|
+ Assert.assertEquals(subClusterId, response.getHomeSubCluster());
|
|
|
Assert.assertEquals(subClusterId, queryApplicationHomeSC(appId));
|
|
|
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- public void testAddApplicationHomeSubClusterMapAppAlreadyExists()
|
|
|
+ public void testAddApplicationHomeSubClusterAppAlreadyExists()
|
|
|
throws Exception {
|
|
|
ApplicationId appId = ApplicationId.newInstance(1, 1);
|
|
|
SubClusterId subClusterId1 = SubClusterId.newInstance("SC1");
|
|
@@ -240,21 +240,17 @@ public abstract class FederationStateStoreBaseTest {
|
|
|
ApplicationHomeSubCluster ahsc2 =
|
|
|
ApplicationHomeSubCluster.newInstance(appId, subClusterId2);
|
|
|
|
|
|
- try {
|
|
|
- stateStore.addApplicationHomeSubClusterMap(
|
|
|
- AddApplicationHomeSubClusterRequest.newInstance(ahsc2));
|
|
|
- Assert.fail();
|
|
|
- } catch (YarnException e) {
|
|
|
- Assert.assertTrue(e.getMessage()
|
|
|
- .startsWith("Application " + appId.toString() + " already exists"));
|
|
|
- }
|
|
|
+ AddApplicationHomeSubClusterResponse response =
|
|
|
+ stateStore.addApplicationHomeSubCluster(
|
|
|
+ AddApplicationHomeSubClusterRequest.newInstance(ahsc2));
|
|
|
|
|
|
+ Assert.assertEquals(subClusterId1, response.getHomeSubCluster());
|
|
|
Assert.assertEquals(subClusterId1, queryApplicationHomeSC(appId));
|
|
|
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- public void testDeleteApplicationHomeSubClusterMap() throws Exception {
|
|
|
+ public void testDeleteApplicationHomeSubCluster() throws Exception {
|
|
|
ApplicationId appId = ApplicationId.newInstance(1, 1);
|
|
|
SubClusterId subClusterId = SubClusterId.newInstance("SC");
|
|
|
addApplicationHomeSC(appId, subClusterId);
|
|
@@ -263,7 +259,7 @@ public abstract class FederationStateStoreBaseTest {
|
|
|
DeleteApplicationHomeSubClusterRequest.newInstance(appId);
|
|
|
|
|
|
DeleteApplicationHomeSubClusterResponse response =
|
|
|
- stateStore.deleteApplicationHomeSubClusterMap(delRequest);
|
|
|
+ stateStore.deleteApplicationHomeSubCluster(delRequest);
|
|
|
|
|
|
Assert.assertNotNull(response);
|
|
|
try {
|
|
@@ -277,14 +273,13 @@ public abstract class FederationStateStoreBaseTest {
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- public void testDeleteApplicationHomeSubClusterMapUnknownApp()
|
|
|
- throws Exception {
|
|
|
+ public void testDeleteApplicationHomeSubClusterUnknownApp() throws Exception {
|
|
|
ApplicationId appId = ApplicationId.newInstance(1, 1);
|
|
|
DeleteApplicationHomeSubClusterRequest delRequest =
|
|
|
DeleteApplicationHomeSubClusterRequest.newInstance(appId);
|
|
|
|
|
|
try {
|
|
|
- stateStore.deleteApplicationHomeSubClusterMap(delRequest);
|
|
|
+ stateStore.deleteApplicationHomeSubCluster(delRequest);
|
|
|
Assert.fail();
|
|
|
} catch (YarnException e) {
|
|
|
Assert.assertTrue(e.getMessage()
|
|
@@ -293,7 +288,7 @@ public abstract class FederationStateStoreBaseTest {
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- public void testGetApplicationHomeSubClusterMap() throws Exception {
|
|
|
+ public void testGetApplicationHomeSubCluster() throws Exception {
|
|
|
ApplicationId appId = ApplicationId.newInstance(1, 1);
|
|
|
SubClusterId subClusterId = SubClusterId.newInstance("SC");
|
|
|
addApplicationHomeSC(appId, subClusterId);
|
|
@@ -302,7 +297,7 @@ public abstract class FederationStateStoreBaseTest {
|
|
|
GetApplicationHomeSubClusterRequest.newInstance(appId);
|
|
|
|
|
|
GetApplicationHomeSubClusterResponse result =
|
|
|
- stateStore.getApplicationHomeSubClusterMap(getRequest);
|
|
|
+ stateStore.getApplicationHomeSubCluster(getRequest);
|
|
|
|
|
|
Assert.assertEquals(appId,
|
|
|
result.getApplicationHomeSubCluster().getApplicationId());
|
|
@@ -311,13 +306,13 @@ public abstract class FederationStateStoreBaseTest {
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- public void testGetApplicationHomeSubClusterMapUnknownApp() throws Exception {
|
|
|
+ public void testGetApplicationHomeSubClusterUnknownApp() throws Exception {
|
|
|
ApplicationId appId = ApplicationId.newInstance(1, 1);
|
|
|
GetApplicationHomeSubClusterRequest request =
|
|
|
GetApplicationHomeSubClusterRequest.newInstance(appId);
|
|
|
|
|
|
try {
|
|
|
- stateStore.getApplicationHomeSubClusterMap(request);
|
|
|
+ stateStore.getApplicationHomeSubCluster(request);
|
|
|
Assert.fail();
|
|
|
} catch (YarnException e) {
|
|
|
Assert.assertTrue(e.getMessage()
|
|
@@ -326,7 +321,7 @@ public abstract class FederationStateStoreBaseTest {
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- public void testGetApplicationsHomeSubClusterMap() throws Exception {
|
|
|
+ public void testGetApplicationsHomeSubCluster() throws Exception {
|
|
|
ApplicationId appId1 = ApplicationId.newInstance(1, 1);
|
|
|
SubClusterId subClusterId1 = SubClusterId.newInstance("SC1");
|
|
|
ApplicationHomeSubCluster ahsc1 =
|
|
@@ -344,7 +339,7 @@ public abstract class FederationStateStoreBaseTest {
|
|
|
GetApplicationsHomeSubClusterRequest.newInstance();
|
|
|
|
|
|
GetApplicationsHomeSubClusterResponse result =
|
|
|
- stateStore.getApplicationsHomeSubClusterMap(getRequest);
|
|
|
+ stateStore.getApplicationsHomeSubCluster(getRequest);
|
|
|
|
|
|
Assert.assertEquals(2, result.getAppsHomeSubClusters().size());
|
|
|
Assert.assertTrue(result.getAppsHomeSubClusters().contains(ahsc1));
|
|
@@ -352,7 +347,7 @@ public abstract class FederationStateStoreBaseTest {
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- public void testUpdateApplicationHomeSubClusterMap() throws Exception {
|
|
|
+ public void testUpdateApplicationHomeSubCluster() throws Exception {
|
|
|
ApplicationId appId = ApplicationId.newInstance(1, 1);
|
|
|
SubClusterId subClusterId1 = SubClusterId.newInstance("SC1");
|
|
|
addApplicationHomeSC(appId, subClusterId1);
|
|
@@ -365,16 +360,14 @@ public abstract class FederationStateStoreBaseTest {
|
|
|
UpdateApplicationHomeSubClusterRequest.newInstance(ahscUpdate);
|
|
|
|
|
|
UpdateApplicationHomeSubClusterResponse response =
|
|
|
- stateStore.updateApplicationHomeSubClusterMap(updateRequest);
|
|
|
+ stateStore.updateApplicationHomeSubCluster(updateRequest);
|
|
|
|
|
|
Assert.assertNotNull(response);
|
|
|
-
|
|
|
Assert.assertEquals(subClusterId2, queryApplicationHomeSC(appId));
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- public void testUpdateApplicationHomeSubClusterMapUnknownApp()
|
|
|
- throws Exception {
|
|
|
+ public void testUpdateApplicationHomeSubClusterUnknownApp() throws Exception {
|
|
|
ApplicationId appId = ApplicationId.newInstance(1, 1);
|
|
|
SubClusterId subClusterId1 = SubClusterId.newInstance("SC1");
|
|
|
ApplicationHomeSubCluster ahsc =
|
|
@@ -384,7 +377,7 @@ public abstract class FederationStateStoreBaseTest {
|
|
|
UpdateApplicationHomeSubClusterRequest.newInstance(ahsc);
|
|
|
|
|
|
try {
|
|
|
- stateStore.updateApplicationHomeSubClusterMap((updateRequest));
|
|
|
+ stateStore.updateApplicationHomeSubCluster((updateRequest));
|
|
|
Assert.fail();
|
|
|
} catch (YarnException e) {
|
|
|
Assert.assertTrue(e.getMessage()
|
|
@@ -484,7 +477,7 @@ public abstract class FederationStateStoreBaseTest {
|
|
|
|
|
|
return SubClusterInfo.newInstance(subClusterId, amRMAddress,
|
|
|
clientRMAddress, rmAdminAddress, webAppAddress, SubClusterState.SC_NEW,
|
|
|
- CLOCK.getTime(), "cabability");
|
|
|
+ CLOCK.getTime(), "capability");
|
|
|
}
|
|
|
|
|
|
private SubClusterPolicyConfiguration createSCPolicyConf(String queueName,
|
|
@@ -499,7 +492,7 @@ public abstract class FederationStateStoreBaseTest {
|
|
|
ApplicationHomeSubCluster.newInstance(appId, subClusterId);
|
|
|
AddApplicationHomeSubClusterRequest request =
|
|
|
AddApplicationHomeSubClusterRequest.newInstance(ahsc);
|
|
|
- stateStore.addApplicationHomeSubClusterMap(request);
|
|
|
+ stateStore.addApplicationHomeSubCluster(request);
|
|
|
}
|
|
|
|
|
|
private void setPolicyConf(String queue, String policyType)
|
|
@@ -510,10 +503,8 @@ public abstract class FederationStateStoreBaseTest {
|
|
|
stateStore.setPolicyConfiguration(request);
|
|
|
}
|
|
|
|
|
|
- private void registerSubCluster(SubClusterId subClusterId)
|
|
|
+ private void registerSubCluster(SubClusterInfo subClusterInfo)
|
|
|
throws YarnException {
|
|
|
-
|
|
|
- SubClusterInfo subClusterInfo = createSubClusterInfo(subClusterId);
|
|
|
stateStore.registerSubCluster(
|
|
|
SubClusterRegisterRequest.newInstance(subClusterInfo));
|
|
|
}
|
|
@@ -531,7 +522,7 @@ public abstract class FederationStateStoreBaseTest {
|
|
|
GetApplicationHomeSubClusterRequest.newInstance(appId);
|
|
|
|
|
|
GetApplicationHomeSubClusterResponse response =
|
|
|
- stateStore.getApplicationHomeSubClusterMap(request);
|
|
|
+ stateStore.getApplicationHomeSubCluster(request);
|
|
|
|
|
|
return response.getApplicationHomeSubCluster().getHomeSubCluster();
|
|
|
}
|