Ejemplo n.º 1
0
 public void testNested() throws Exception {
   BasicContextOriented co = new BasicContextOriented(new CoinjemaContext("custom"));
   assertEquals("A Test String", co.getSimple().getCircular().getTest());
   assertEquals("test string", co.getSimple().getTest());
   assertEquals(
       co.getMyService(), co.getSimple().getCircular().getCircular().getCircular().getService());
 }
Ejemplo n.º 2
0
 public void testParallelSingletonContextualize() throws Exception {
   BasicContextOriented co2 = new BasicContextOriented(new CoinjemaContext("units/elf"));
   BasicContextOriented b = new BasicContextOriented(new CoinjemaContext("units/orc"));
   assertEquals(co2.getMyService(), b.getMyService());
   assertEquals(
       new CoinjemaContext(""), ((ContextOriented) co2.getMyService()).getCoinjemaContext());
 }
Ejemplo n.º 3
0
 public void testLoggingSetup() throws Exception {
   BasicContextOriented co1 = new BasicContextOriented();
   PerformanceTestObject pto = new PerformanceTestObject();
   assertTrue(co1.getLog() != null);
   assertTrue(pto.getLog() != null);
   assertNotSame(co1.getLog(), pto.getLog());
   co1.testLogging();
   co1 = new BasicContextOriented(new CoinjemaContext("config2"));
   co1.testLogging();
   pto.getLog().info("My Other Logger works great too!");
 }
Ejemplo n.º 4
0
 public void testSmartSubContext() throws Exception {
   BasicContextOriented co1 = new BasicContextOriented(new CoinjemaContext("units/elf"));
   assertEquals("elf_path1", co1.getPaths()[0]);
   BasicContextOriented co2 = new BasicContextOriented(new CoinjemaContext("custom"));
   BasicContextOriented co3 = co2.getSubObject("units/elf");
   assertEquals("custom/units/elf", co3.getPaths()[0]);
 }
Ejemplo n.º 5
0
 public void testBasicCO() throws Exception {
   BasicContextOriented co = new BasicContextOriented();
   assertNotNull(co);
   assertEquals("path1", co.getPaths()[0]);
   assertEquals("path2", co.getPaths()[1]);
   assertEquals(new URL("http://coinjema.sourceforge.net/"), co.getHome());
   BasicContextOriented co2 = new BasicContextOriented();
   assertNotNull(co2);
   assertEquals("path1", co2.getPaths()[0]);
   assertEquals("path2", co2.getPaths()[1]);
   assertEquals(new URL("http://coinjema.sourceforge.net/"), co2.getHome());
 }
Ejemplo n.º 6
0
 public void testSubContext() throws Exception {
   BasicContextOriented co2 = new BasicContextOriented(new CoinjemaContext("config2"));
   BasicContextOriented co1 = new BasicContextOriented();
   assertEquals("Root Value", co1.getRedirectedService().getMainValue());
   assertEquals("config2 Value", co2.getRedirectedService().getMainValue());
   assertEquals("path1", co2.getPaths()[0]);
   BasicContextOriented co3 = new BasicContextOriented(new CoinjemaContext("override"));
   assertEquals("path3", co3.getPaths()[0]);
   assertEquals("path4", co3.getPaths()[1]);
   BasicContextOriented co4 = co3.getSubObject();
   assertEquals("path3", co4.getPaths()[0]);
   assertEquals("path4", co4.getPaths()[1]);
   co4 = co3.getSubObject(co1);
   assertEquals("path1", co4.getPaths()[0]);
 }
Ejemplo n.º 7
0
 public void testContextConstructors() throws Exception {
   BasicContextOriented co = new BasicContextOriented("newTest", new CoinjemaContext("units"));
   assertEquals("newTest", co.getInit());
   assertEquals("doobie", co.getProp("mysmoke"));
 }
Ejemplo n.º 8
0
 public void testProperty() throws Exception {
   BasicContextOriented co = new BasicContextOriented(new CoinjemaContext("units"));
   assertEquals("doobie", co.getProp("mysmoke"));
 }
Ejemplo n.º 9
0
 public void testAnnotatedSingleton() throws Exception {
   BasicContextOriented co1 = new BasicContextOriented();
   assertEquals("Root Value", co1.getMyMainValue());
   assertEquals("Other Root", co1.getMyOtherMainValue());
 }
Ejemplo n.º 10
0
 public void testTooDeepContextFind() throws Exception {
   BasicContextOriented elf = new BasicContextOriented(new CoinjemaContext("units/elf/empty.txt"));
   BasicContextOriented orc = elf.getSubObject("orc");
   assertEquals("orc_path2", orc.getPaths()[1]);
 }