use of org.alfresco.repo.management.subsystems.test.TestService in project alfresco-repository by Alfresco.
the class SubsystemsTest method testSubsystems.
/**
* Test subsystems.
*
* @throws Exception
* the exception
*/
@Test
public void testSubsystems() throws Exception {
ApplicationContextFactory subsystem = (ApplicationContextFactory) applicationContext.getBean("testsubsystem");
ConfigurableApplicationContext childContext = (ConfigurableApplicationContext) subsystem.getApplicationContext();
assertTrue("Subsystem not started", childContext.isActive());
TestService testService = (TestService) childContext.getBean("testService");
// Make sure subsystem defaults work
assertEquals("Subsystem Default1", testService.getSimpleProp1());
// Make sure global property overrides work
assertEquals(true, testService.getSimpleProp2().booleanValue());
// Make sure extension classpath property overrides work
assertEquals("Instance Override3", testService.getSimpleProp3());
// Make sure extension classpath Spring overrides work
assertEquals("An extra bean I changed", childContext.getBean("anotherBean"));
// Make sure composite properties and their defaults work
TestBean[] testBeans = testService.getTestBeans();
assertNotNull("Composite property not set", testBeans);
assertEquals(3, testBeans.length);
assertEquals("inst1", testBeans[0].getId());
assertEquals(false, testBeans[0].isBoolProperty());
assertEquals(123456789123456789L, testBeans[0].getLongProperty());
assertEquals("Global Default", testBeans[0].getAnotherStringProperty());
assertEquals("inst2", testBeans[1].getId());
assertEquals(true, testBeans[1].isBoolProperty());
assertEquals(123456789123456789L, testBeans[1].getLongProperty());
assertEquals("Global Default", testBeans[1].getAnotherStringProperty());
assertEquals("inst3", testBeans[2].getId());
assertEquals(false, testBeans[2].isBoolProperty());
assertEquals(123456789123456789L, testBeans[2].getLongProperty());
assertEquals("Global Instance Default", testBeans[2].getAnotherStringProperty());
}
Aggregations