@Deployment
 public static Archive<?> deploy() {
   return ShrinkWrap.create(
           BeanArchive.class, Utils.getDeploymentNameAsHash(AnnotatedTypeObserversTest.class))
       .addPackage(RoomsExtension.class.getPackage())
       .addAsServiceProvider(Extension.class, RoomsExtension.class);
 }
Example #2
0
 @Deployment
 public static Archive<?> deploy() {
   return ShrinkWrap.create(
           BeanArchive.class, Utils.getDeploymentNameAsHash(AlternativesTest.class))
       .stereotype(TestAlternative.class)
       .addPackage(Alternatives2Test.class.getPackage());
 }
 @Deployment
 public static Archive<?> deploy() {
   return ShrinkWrap.create(
           BeanArchive.class, Utils.getDeploymentNameAsHash(ManagedBeanBridgeMethodTest.class))
       .intercept(SomeInterceptor.class)
       .addPackage(BaseService.class.getPackage())
       .addPackage(ManagedBeanBridgeMethodTest.class.getPackage());
 }
 @Deployment
 @ShouldThrowException(DeploymentException.class)
 public static JavaArchive getDeployment() {
   return ShrinkWrap.create(
           BeanArchive.class,
           Utils.getDeploymentNameAsHash(NonPrivateNonStaticFinalMethodTest.class))
       .addClasses(Swan.class, SwanLake.class);
 }
 @Deployment
 public static Archive<?> getDeployment() {
   return ShrinkWrap.create(
           BeanArchive.class,
           Utils.getDeploymentNameAsHash(
               RequestScopeActiveDuringSingletonStartupWithDependenciesTest.class))
       .addPackage(
           RequestScopeActiveDuringSingletonStartupWithDependenciesTest.class.getPackage());
 }
 @Deployment
 public static Archive<?> getDeployment() {
   return ShrinkWrap.create(
           BeanArchive.class,
           Utils.getDeploymentNameAsHash(AroundConstructInterceptorLifecycleTest.class))
       .intercept(AlphaInterceptor.class)
       .addPackage(AroundConstructInterceptorLifecycleTest.class.getPackage())
       .addClasses(Utils.class);
 }
 @ShouldThrowException(DefinitionException.class)
 @Deployment
 public static Archive<?> getDeployment() {
   return ShrinkWrap.create(
           BeanArchive.class,
           Utils.getDeploymentNameAsHash(DifferentNamesOfSpecializedBeansTest.class))
       .addPackage(DifferentNamesOfSpecializedBeansTest.class.getPackage())
       .addAsServiceProvider(Extension.class, ModifyingExtension.class);
 }
 @Deployment
 @ShouldThrowException(DeploymentException.class)
 public static JavaArchive getDeployment() {
   return ShrinkWrap.create(
           BeanArchive.class,
           Utils.getDeploymentNameAsHash(NonPassivatingConstructorParameterTest.class))
       .intercept(BioInterceptor.class)
       .decorate(AnimalDecorator.class)
       .addClasses(getCommonClasses())
       .addClasses(FarmBroken1.class);
 }
Example #9
0
 @Deployment
 public static Archive getDeployment() {
   return ShrinkWrap.create(BeanArchive.class, Utils.getDeploymentNameAsHash(SmokeTest.class))
       .addPackage(Crasher.class.getPackage());
 }
 // WELDINT-45
 @Test
 public void testNoInterfaceView(Mouse mouse) throws Exception {
   Assert.assertTrue(Utils.isProxy(mouse));
   Assert.assertTrue(mouse instanceof Mouse);
 }
Example #11
0
  @Test(description = "A simple test to check conversation replication")
  public void testConversationReplication() throws Exception {

    TestContainer container1 = bootstrapContainer(1, Collections.singletonList(Baz.class));
    BeanManagerImpl beanManager1 = getBeanManager(container1);

    TestContainer container2 = bootstrapContainer(2, Collections.singletonList(Baz.class));
    BeanManagerImpl beanManager2 = getBeanManager(container2);

    use(1);

    // Set up the conversation context
    BoundRequest request1 = new BoundRequestImpl(container1.getSessionStore());
    BoundConversationContext conversationContext1 =
        Utils.getReference(beanManager1, BoundConversationContext.class);
    conversationContext1.associate(request1);
    conversationContext1.activate();

    // Set a value into Baz1
    Baz baz1 = Utils.getReference(beanManager1, Baz.class);
    baz1.setName("pete");

    // Begin the conversation
    Conversation conversation1 = Utils.getReference(beanManager1, Conversation.class);
    conversation1.begin();

    // refetch the test bean and check it has the right value
    baz1 = Utils.getReference(beanManager1, Baz.class);
    assert baz1.getName().equals("pete");

    // Simulate ending the request (from the POV of the conversation only!)
    assert !conversation1.isTransient();
    String cid = conversation1.getId();
    conversationContext1.invalidate();
    conversationContext1.deactivate();
    conversationContext1.dissociate(request1);

    // and start another, propagating the conversation
    request1 = new BoundRequestImpl(container1.getSessionStore());
    conversationContext1.associate(request1);
    conversationContext1.activate(cid);

    // refetch the test bean and check it has the right value
    baz1 = Utils.getReference(beanManager1, Baz.class);
    assert baz1.getName().equals("pete");
    assert !conversation1.isTransient();

    replicateSession(1, container1, 2, container2);

    use(2);

    // Set up the conversation context
    BoundRequest request2 = new BoundRequestImpl(container2.getSessionStore());
    BoundConversationContext conversationContext2 =
        Utils.getReference(beanManager2, BoundConversationContext.class);
    conversationContext2.associate(request2);
    conversationContext2.activate(cid);

    Baz baz2 = Utils.getReference(beanManager2, Baz.class);
    assert baz2.getName().equals("pete");

    Conversation conversation2 = Utils.getReference(beanManager2, Conversation.class);
    assert !conversation2.isTransient();

    use(2);
    container2.stopContainer();
    use(1);
    container1.stopContainer();
  }