SoftwareManagementClient implements SoftwareManagement.Iface { @Override public int runClusterOperation(ClusterOperation clusterOperation) { try { return managementClient.runClusterOperation(clusterOperation); } catch (ClusterOperationException e) { logger.error("Failed run cluseter operation for cluster: " + clusterOperation.getTargetName()); throw SoftwareManagementException.CLUSTER_OPERATIOIN_FAILURE(e, clusterOperation.getTargetName(), clusterOperation.getAction() .toString(), e.getMessage()); } catch (Throwable t) { throw SoftwareManagementException.CLUSTER_OPERATIOIN_UNKNOWN_ERROR(t, clusterOperation.getTargetName(), clusterOperation.getAction() .toString()); } }  void init(); void close(); @Override int runClusterOperation(ClusterOperation clusterOperation); @Override OperationStatusWithDetail getOperationStatusWithDetail(
         String targetName); @Override void resetNodeProvisionAttribute(String targetName);  }
@Test(groups = { "software-management" }) public void createCluster() { ClusterOperation clusterOperation = new ClusterOperation(); clusterOperation.setAction(ClusterAction.CREATE); clusterOperation.setTargetName(clusterName); clusterOperation.setSpecFileName(configFileName); try { when(handler.runClusterOperation(clusterOperation)).thenReturn(0); } catch (TException e) { fail("Exception when calling runClusterOperation", e); } assertEquals(client.runClusterOperation(clusterOperation), 0); }
@Test(groups = { "software-management" }) public void queryCluster() { ClusterOperation clusterOperation = new ClusterOperation(); clusterOperation.setAction(ClusterAction.QUERY); clusterOperation.setTargetName(clusterName); clusterOperation.setSpecFileName(configFileName); try { when(handler.runClusterOperation(clusterOperation)).thenReturn(0); } catch (TException e) { fail("Exception when calling runClusterOperation", e); } assertEquals(client.runClusterOperation(clusterOperation), 0); }
@Test(groups = { "software-management" }) public void updateCluster() { ClusterOperation clusterOperation = new ClusterOperation(); clusterOperation.setAction(ClusterAction.UPDATE); clusterOperation.setTargetName(clusterName); clusterOperation.setSpecFileName(configFileName); try { when(handler.runClusterOperation(clusterOperation)).thenReturn(0); } catch (TException e) { fail("Exception when calling runClusterOperation", e); } assertEquals(client.runClusterOperation(clusterOperation), 0); }
@Test(groups = { "software-management" }) public void startCluster() { ClusterOperation clusterOperation = new ClusterOperation(); clusterOperation.setAction(ClusterAction.START); clusterOperation.setTargetName(clusterName); clusterOperation.setSpecFileName(configFileName); try { when(handler.runClusterOperation(clusterOperation)).thenReturn(0); } catch (TException e) { fail("Exception when calling runClusterOperation", e); } assertEquals(client.runClusterOperation(clusterOperation), 0); }
@Test(groups = { "software-management" }) public void stopCluster() { ClusterOperation clusterOperation = new ClusterOperation(); clusterOperation.setAction(ClusterAction.STOP); clusterOperation.setTargetName(clusterName); clusterOperation.setSpecFileName(configFileName); try { when(handler.runClusterOperation(clusterOperation)).thenReturn(0); } catch (TException e) { fail("Exception when calling runClusterOperation", e); } assertEquals(client.runClusterOperation(clusterOperation), 0); }
@Test(groups = { "software-management" }) public void deleteCluster() { ClusterOperation clusterOperation = new ClusterOperation(); clusterOperation.setAction(ClusterAction.DESTROY); clusterOperation.setTargetName(clusterName); clusterOperation.setSpecFileName(configFileName); try { when(handler.runClusterOperation(clusterOperation)).thenReturn(0); } catch (TException e) { fail("Exception when calling runClusterOperation", e); } assertEquals(client.runClusterOperation(clusterOperation), 0); }
@Test(groups = { "software-management" }) public void configureCluster() { ClusterOperation clusterOperation = new ClusterOperation(); clusterOperation.setAction(ClusterAction.CONFIGURE); clusterOperation.setTargetName(clusterName); clusterOperation.setSpecFileName(configFileName); try { when(handler.runClusterOperation(clusterOperation)).thenReturn(0); } catch (TException e) { fail("Exception when calling runClusterOperation", e); } assertEquals(client.runClusterOperation(clusterOperation), 0); }