Package org.jboss.arquillian.impl.core

Examples of org.jboss.arquillian.impl.core.ManagerImpl


   }
  
   @Test
   public void shouldBeAbleToFireExceptionEventOnFailingObserver() throws Exception
   {
      ManagerImpl manager = ManagerBuilder.from()
         .extensions(ExtensionWithExceptionObserver.class, ExtensionObservingException.class).create();
     
      manager.fire(new String("should cause exception"));
     
      Assert.assertTrue(manager.getExtension(ExtensionObservingException.class).methodOneWasCalled);
   }
View Full Code Here


   }

   @Test(expected = IOException.class)
   public void shouldBeAbleToDetectExceptionEventLoopAndThrowOriginalException() throws Exception
   {
      ManagerImpl manager = ManagerBuilder.from()
         .extensions(ExtensionObservingExceptionLoop.class).create();
     
      manager.fire(new IOException("should cause exception"));
     
  }
View Full Code Here

public class EventImplTestCase
{
   @Test
   public void shouldBeAbleToFireEvent() throws Exception
   {
      ManagerImpl manager = ManagerBuilder.from()
         .extensions(TestObserver.class).create();
     
      EventImpl<Object> event = EventImpl.of(Object.class, manager);
     
      Object testObject = new Object();
      event.fire(testObject);
     
      TestObserver observer = manager.getExtension(TestObserver.class);
      Assert.assertTrue(observer.wasCalled);
      Assert.assertEquals(
            "Verify same object was observed",
            testObject, observer.getObject());
   }
View Full Code Here

{

   @Test
   public void shouldBeAbleToInjectAndFireEvents() throws Exception
   {
      ManagerImpl manager = ManagerBuilder.from()
         .context(SuiteContextImpl.class)
         .context(ContainerContextImpl.class)
         .extensions(
               TestObserverOne.class,
               TestObserverTwo.class,
               TestObserverTree.class).create();
     
      SuiteContext context = manager.getContext(SuiteContext.class);
      try
      {
         context.activate();
         context.getObjectStore().add(Object.class, new Object());
        
        
         manager.fire("some string event");

         Assert.assertTrue(manager.getExtension(TestObserverOne.class).wasCalled);
         Assert.assertTrue(manager.getExtension(TestObserverTwo.class).wasCalled);
         Assert.assertTrue(manager.getExtension(TestObserverTree.class).wasCalled);
        
         Assert.assertNotNull(
               "Verify instance was bound to context",
               context.getObjectStore().get(Object.class));
        
         ContainerContext containerContext = manager.getContext(ContainerContext.class);
         Assert.assertFalse(containerContext.isActive());
        
         containerContext.activate("");
         try
         {
View Full Code Here

public class InstanceImplTestCase
{
   @Test
   public void shouldBeAbleToLookupInContext() throws Exception
   {
      ManagerImpl manager = ManagerBuilder.from()
         .context(SuiteContextImpl.class).create();

      Object testObject = new Object();
      SuiteContext context = manager.getContext(SuiteContext.class);
      try
      {
         context.activate();
         context.getObjectStore().add(Object.class, testObject);
        
View Full Code Here

   }

   @Test
   public void shouldFireEventOnSet() throws Exception
   {
      ManagerImpl manager = ManagerBuilder.from()
         .context(SuiteContextImpl.class)
         .extension(TestObserver.class).create();

      SuiteContext context = manager.getContext(SuiteContext.class);
      try
      {
         context.activate();
        
         InstanceProducer<Object> instance = InstanceImpl.of(Object.class, SuiteScoped.class, manager);
         instance.set(new Object());

         Assert.assertTrue(manager.getExtension(TestObserver.class).wasCalled);
      }
      finally
      {
         context.deactivate();
         context.destroy();
View Full Code Here

   }

   @Test(expected = IllegalStateException.class)
   public void shouldThrowExceptionIfTryingToSetAUnScopedInstance() throws Exception
   {
      ManagerImpl manager = ManagerBuilder.from().create();
      InstanceProducer<Object> instance = InstanceImpl.of(Object.class, null, manager);
     
      instance.set(new Object());
      Assert.fail("Should have thrown " + IllegalStateException.class);
   }
View Full Code Here

TOP

Related Classes of org.jboss.arquillian.impl.core.ManagerImpl

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.