use of org.apache.mesos.state.InMemoryState in project cassandra-mesos-deprecated by mesosphere.
the class PersistedCassandraFrameworkConfigurationTest method testGetDefaultRackDc.
@Test
public void testGetDefaultRackDc() {
InMemoryState state = new InMemoryState();
PersistedCassandraFrameworkConfiguration config = new PersistedCassandraFrameworkConfiguration(state, "name", 60, 30, "2.1", 0.5, 1024, 1024, 512, 1, 1, "role", "./backup", ".", false, true, "RACK5", "DC5", Lists.<ExternalDc>newArrayList(), "clusterName");
CassandraFrameworkProtos.RackDc rackDc = config.getDefaultRackDc();
assertEquals("RACK5", rackDc.getRack());
assertEquals("DC5", rackDc.getDc());
// backward compatibility: if rackDc is not defined - use defaults
CassandraFrameworkConfiguration.Builder builder = CassandraFrameworkConfiguration.newBuilder(config.get());
builder.setDefaultConfigRole(CassandraConfigRole.newBuilder(builder.getDefaultConfigRole()).clearRackDc());
config.setValue(builder.build());
rackDc = config.getDefaultRackDc();
assertEquals("RAC1", rackDc.getRack());
assertEquals("DC1", rackDc.getDc());
}
use of org.apache.mesos.state.InMemoryState in project cassandra-mesos-deprecated by mesosphere.
the class SeedManagerTest method before.
@Before
public void before() {
InMemoryState state = new InMemoryState();
PersistedCassandraFrameworkConfiguration config = new PersistedCassandraFrameworkConfiguration(state, "name", 60, 30, "2.1", 0.5, 1024, 1024, 512, 1, 1, "role", "./backup", ".", false, true, "RACK1", "DC1", Arrays.asList(ExternalDc.newBuilder().setName("dc").setUrl("http://dc").build()), "name");
seedManager = new SeedManager(config, new ObjectMapper(), new SystemClock()) {
@Override
@Nullable
protected JsonNode fetchJson(@NotNull final String url) {
try {
return new ObjectMapper().readTree(jsonResponse);
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
};
}
use of org.apache.mesos.state.InMemoryState in project cassandra-mesos-deprecated by mesosphere.
the class PersistedCassandraFrameworkConfigurationTest method generatingNewConfigAllowsFrameworkNameAndClusterNameToBeDifferent.
@Test
public void generatingNewConfigAllowsFrameworkNameAndClusterNameToBeDifferent() throws Exception {
final State state = new InMemoryState();
final PersistedCassandraFrameworkConfiguration configuration = new PersistedCassandraFrameworkConfiguration(state, "cassandra.frameworkName", 15, 15, "2.1.4", 1.0, 2048, 2048, 1024, 1, 1, "*", "./backup", ".", true, true, "rack1", "dc1", Collections.<ExternalDc>emptyList(), "clusterName");
assertThat(configuration.frameworkName()).isEqualTo("cassandra.frameworkName");
assertThat(configuration.clusterName()).isEqualTo("clusterName");
}
Aggregations