Package org.jboss.arquillian.core.test.context

Examples of org.jboss.arquillian.core.test.context.ManagerTest2Context


   }

   @Test
   public void shouldBeAbleToStackContextOfSameType()
   {
      ManagerTest2Context context = new ManagerTest2ContextImpl();

      try
      {
         context.activate("PARENT");
         context.getObjectStore().add(String.class, "test");

         try
         {
            context.activate("CHILD");
            Assert.assertNull(
                  "Should not be able to read from previously stacked context",
                  context.getObjectStore().get(String.class));

         }
         finally
         {
            context.deactivate();
         }

         Assert.assertTrue(
               "Outer Context should still be active",
               context.isActive());
      }
      finally
      {
         context.deactivate();
         context.clearAll();
      }
   }
View Full Code Here


        
         Assert.assertNotNull(
               "Verify instance was bound to context",
               context.getObjectStore().get(Object.class));
        
         ManagerTest2Context containerContext = manager.getContext(ManagerTest2Context.class);
         Assert.assertFalse(containerContext.isActive());
        
         containerContext.activate("A");
         try
         {
            Assert.assertNotNull(
                  "Should have set a Double in container scope",
                  containerContext.getObjectStore().get(Double.class));
         }
         finally
         {
            containerContext.deactivate();
            containerContext.destroy("A");
         }
      }
      finally
      {
         context.deactivate();
View Full Code Here

      ManagerImpl manager = (ManagerImpl)ManagerBuilder.from()
         .context(ManagerTestContextImpl.class)
         .context(ManagerTest2ContextImpl.class).create();

      ManagerTestContext suiteContext = manager.getContext(ManagerTestContext.class);
      ManagerTest2Context classContext = manager.getContext(ManagerTest2Context.class);

      try
      {
         suiteContext.activate();
         classContext.activate("A");
        
         Object testObject = new Object();
        
         manager.bind(ManagerTestScoped.class, Object.class, testObject);
        
         Assert.assertEquals(
               "Verify value was bound to the correct context",
               testObject,
               suiteContext.getObjectStore().get(Object.class));

         Assert.assertNull(
               "Verify value was not bound to any other context",
               classContext.getObjectStore().get(Object.class));
      }
      finally
      {
         classContext.deactivate();
         classContext.destroy("A");
         suiteContext.deactivate();
         suiteContext.destroy();
      }
   }
View Full Code Here

   }
  
   @Test
   public void shouldBeAbleToStackContextOfSameType()
   {
      ManagerTest2Context context = new ManagerTest2ContextImpl();     
     
      try
      {
         context.activate("PARENT");
         context.getObjectStore().add(String.class, "test");
        
         try
         {
            context.activate("CHILD");
            Assert.assertNull(
                  "Should not be able to read from previously stacked context",
                  context.getObjectStore().get(String.class));
           
         }
         finally
         {
            context.deactivate();
         }
        
         Assert.assertTrue(
               "Outer Context should still be active",
               context.isActive());
      }
      finally
      {
         context.deactivate();
         context.clearAll();
      }
   }
View Full Code Here

TOP

Related Classes of org.jboss.arquillian.core.test.context.ManagerTest2Context

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.