@Test public void sourceBeanIsUpdateableWhenCurrentStoreIsUnencrypted() { initSwitchableContext(UNENCRYPTED_STORE_SUBSYSTEM); boolean updateable = switchableContext.isUpdateable(SOURCE_BEAN_NAME_PROPERTY); assertTrue("It should be possible to switch subsystems when the current store is unencrypted.", updateable); }
@Test public void sourceBeanIsNotUpdatableWhenCurrentStoreIsEncrypted() { initSwitchableContext(ENCRYPTED_STORE_SUBSYSTEM); boolean updateable = switchableContext.isUpdateable(SOURCE_BEAN_NAME_PROPERTY); assertFalse("It should not be possible to switch subsystems when the current store is encrypted.", updateable); }
@Test public void canSetSourceBeanWhenCurrentStoreIsUnencrypted() { initSwitchableContext(UNENCRYPTED_STORE_SUBSYSTEM); switchableContext.setProperty(SOURCE_BEAN_NAME_PROPERTY, ENCRYPTED_STORE_SUBSYSTEM); assertEquals(ENCRYPTED_STORE_SUBSYSTEM, switchableContext.getProperty(SOURCE_BEAN_NAME_PROPERTY)); }
@Test public void cannotSetSourceBeanWhenCurrentStoreIsEncrypted() { initSwitchableContext(ENCRYPTED_STORE_SUBSYSTEM); try { switchableContext.setProperty(SOURCE_BEAN_NAME_PROPERTY, UNENCRYPTED_STORE_SUBSYSTEM); fail("It shouldn't be possible to switch to an unencrypted content store from an encrypted one."); } catch (IllegalStateException e) { // Good } assertEquals(ENCRYPTED_STORE_SUBSYSTEM, switchableContext.getProperty(SOURCE_BEAN_NAME_PROPERTY)); }