@Test public void testValidateDedicatedServerStoreBad() throws Exception { ClusterTierActiveEntity activeEntity = new ClusterTierActiveEntity(defaultRegistry, defaultConfiguration, DEFAULT_MAPPER); activeEntity.createNew(); TestInvokeContext context = new TestInvokeContext(); activeEntity.connected(context.getClientDescriptor()); assertFailure(activeEntity.invokeActive(context, new LifecycleMessage.ValidateServerStore(defaultStoreName, new ServerStoreConfigBuilder() .dedicated(defaultResource, 8, MemoryUnit.MEGABYTES) .build())), InvalidServerStoreConfigurationException.class); }
@Test public void testValidateServerStore_DedicatedStoresDifferentSizes() throws Exception { ClusterTierActiveEntity activeEntity = new ClusterTierActiveEntity(defaultRegistry, defaultConfiguration, DEFAULT_MAPPER); activeEntity.createNew(); TestInvokeContext context = new TestInvokeContext(); activeEntity.connected(context.getClientDescriptor()); ServerStoreConfiguration storeConfiguration = new ServerStoreConfigBuilder() .dedicated(defaultResource, 2, MemoryUnit.MEGABYTES) .build(); String expectedMessageContent = "Existing ServerStore configuration is not compatible with the desired configuration: " + "\n\t" + "resourcePoolType existing: " + defaultStoreConfiguration.getPoolAllocation() + ", desired: " + storeConfiguration.getPoolAllocation(); assertFailure(activeEntity.invokeActive(context, new LifecycleMessage.ValidateServerStore(defaultStoreName, storeConfiguration)), InvalidServerStoreConfigurationException.class, expectedMessageContent); }
@Test public void testValidateServerStore_DedicatedStoreResourceNamesDifferent() throws Exception { ClusterTierActiveEntity activeEntity = new ClusterTierActiveEntity(defaultRegistry, defaultConfiguration, DEFAULT_MAPPER); activeEntity.createNew(); TestInvokeContext context = new TestInvokeContext(); activeEntity.connected(context.getClientDescriptor()); ServerStoreConfiguration storeConfiguration = new ServerStoreConfigBuilder() .dedicated("otherResource", 1, MemoryUnit.MEGABYTES) .build(); String expectedMessageContent = "Existing ServerStore configuration is not compatible with the desired configuration: " + "\n\t" + "resourcePoolType existing: " + defaultStoreConfiguration.getPoolAllocation() + ", desired: " + storeConfiguration.getPoolAllocation(); assertFailure(activeEntity.invokeActive(context, new LifecycleMessage.ValidateServerStore(defaultStoreName, storeConfiguration)), InvalidServerStoreConfigurationException.class, expectedMessageContent); }
@Test public void testValidateServerStore_DifferentSharedPools() throws Exception { defaultRegistry.addSharedPool(defaultSharedPool, MemoryUnit.MEGABYTES.toBytes(2), defaultResource); ServerStoreConfiguration storeConfiguration = new ServerStoreConfigBuilder() .shared(defaultSharedPool) .build(); ClusterTierActiveEntity activeEntity = new ClusterTierActiveEntity(defaultRegistry, new ClusterTierEntityConfiguration(identifier, defaultStoreName, storeConfiguration), DEFAULT_MAPPER); activeEntity.createNew(); TestInvokeContext context = new TestInvokeContext(); activeEntity.connected(context.getClientDescriptor()); ServerStoreConfiguration otherConfiguration = new ServerStoreConfigBuilder() .shared("other") .build(); String expectedMessageContent = "Existing ServerStore configuration is not compatible with the desired configuration: " + "\n\t" + "resourcePoolType existing: " + storeConfiguration.getPoolAllocation() + ", desired: " + otherConfiguration.getPoolAllocation(); assertFailure(activeEntity.invokeActive(context, new LifecycleMessage.ValidateServerStore(defaultStoreName, otherConfiguration)),InvalidServerStoreConfigurationException.class,expectedMessageContent); }