ClusterActivationNomadChangeProcessor implements NomadChangeProcessor<ClusterActivationNomadChange> { @Override public void validate(NodeContext baseConfig, ClusterActivationNomadChange change) throws NomadException { LOGGER.info("Validating change: {}", change.getSummary()); if (baseConfig != null) { throw new NomadException("Found an existing configuration: " + baseConfig); } if (!change.getCluster().containsNode(nodeUID)) { throw new NomadException("Node: " + nodeUID + " not found in cluster: " + change.getCluster()); } } ClusterActivationNomadChangeProcessor(UID nodeUID); @Override void validate(NodeContext baseConfig, ClusterActivationNomadChange change); @Override void apply(ClusterActivationNomadChange change);  }
@Test public void testCanApplyWithNonNullBaseConfig() throws Exception { ClusterActivationNomadChange change = new ClusterActivationNomadChange(Testing.newTestCluster("cluster")); NodeContext topology = new NodeContext( Testing.newTestCluster( Testing.newTestStripe("stripe-1").addNodes( Testing.newTestNode("foo", "localhost"))), Testing.N_UIDS[1]); expectedException.expect(NomadException.class); expectedException.expectMessage("Found an existing configuration: " + topology); processor.validate(topology, change); }