Package org.apache.openejb.plugins.common

Examples of org.apache.openejb.plugins.common.SessionBeanConverter


 
  public void testShouldGenerateInterceptorAnnotations() throws Exception {
    // setup
   
    final IJDTFacade facade = context.mock(IJDTFacade.class);
    SessionBeanConverter converter = new SessionBeanConverter(facade);

    // expectations
    context.checking(new Expectations(){{
      one(facade).addClassAnnotation("test.TestBean", Interceptors.class, createNameValuePair("value", new String[] { SessionBeanConverterTest.class.getCanonicalName() })); //$NON-NLS-1$ //$NON-NLS-2$
    }});

    EjbJar ejbJar = new EjbJar();
    EnterpriseBean bean = addStatefulBeanToEjbJar(ejbJar, "TestBean", "test.TestBean"); //$NON-NLS-1$ //$NON-NLS-2$
   
    Interceptor interceptor = new Interceptor(SessionBeanConverterTest.class);
    ejbJar.addInterceptor(interceptor);
    List<InterceptorBinding> interceptorBindings = ejbJar.getAssemblyDescriptor().getInterceptorBinding();
   
    InterceptorBinding binding = new InterceptorBinding(bean, interceptor);
    interceptorBindings.add(binding);
   
    // execute
    converter.processInterceptors(ejbJar);

    // verify
    context.assertIsSatisfied();
  }
View Full Code Here


  public void testShouldGenerateMethodInterceptorAnnotations() throws Exception {
    // setup
   
    final IJDTFacade facade = context.mock(IJDTFacade.class);
    SessionBeanConverter converter = new SessionBeanConverter(facade);

    // expectations
    context.checking(new Expectations(){{
      one(facade).addMethodAnnotation("test.TestBean", "test", new String[0], Interceptors.class, createNameValuePair("value", new String[] { SessionBeanConverterTest.class.getCanonicalName() })); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    }});

    EjbJar ejbJar = new EjbJar();
    EnterpriseBean bean = addStatefulBeanToEjbJar(ejbJar, "TestBean", "test.TestBean"); //$NON-NLS-1$ //$NON-NLS-2$
   
    Interceptor interceptor = new Interceptor(SessionBeanConverterTest.class);
    ejbJar.addInterceptor(interceptor);
    List<InterceptorBinding> interceptorBindings = ejbJar.getAssemblyDescriptor().getInterceptorBinding();
   
    InterceptorBinding binding = new InterceptorBinding(bean, interceptor);
    NamedMethod method = new NamedMethod();
    method.setMethodName("test"); //$NON-NLS-1$
    method.setMethodParams(new MethodParams());
    binding.setMethod(method);
    interceptorBindings.add(binding);
   
    // execute
    converter.processInterceptors(ejbJar);

    // verify
    context.assertIsSatisfied();
  }
View Full Code Here

  public void testShouldGenerateExcludeDefaultInterceptorAnnotations() throws Exception {
    // setup
   
    final IJDTFacade facade = context.mock(IJDTFacade.class);
    SessionBeanConverter converter = new SessionBeanConverter(facade);

    // expectations
    context.checking(new Expectations(){{
      one(facade).addClassAnnotation("test.TestBean", Interceptors.class, createNameValuePair("value", new String[] { SessionBeanConverterTest.class.getCanonicalName() })); //$NON-NLS-1$ //$NON-NLS-2$
      one(facade).addClassAnnotation("test.TestBean", ExcludeDefaultInterceptors.class, createNameValuePair("value", new String[] { SessionBeanConverterTest.class.getCanonicalName() })); //$NON-NLS-1$ //$NON-NLS-2$
    }});

    EjbJar ejbJar = new EjbJar();
    EnterpriseBean bean = addStatefulBeanToEjbJar(ejbJar, "TestBean", "test.TestBean"); //$NON-NLS-1$ //$NON-NLS-2$
   
    Interceptor interceptor = new Interceptor(SessionBeanConverterTest.class);
    ejbJar.addInterceptor(interceptor);
    List<InterceptorBinding> interceptorBindings = ejbJar.getAssemblyDescriptor().getInterceptorBinding();
   
    InterceptorBinding binding = new InterceptorBinding(bean, interceptor);
    binding.setExcludeDefaultInterceptors(true);
    interceptorBindings.add(binding);
   
    // execute
    converter.processInterceptors(ejbJar);

    // verify
    context.assertIsSatisfied();
  }
View Full Code Here

  public void testShouldGenerateDefaultExcludeMethodInterceptorAnnotations() throws Exception {
    // setup
   
    final IJDTFacade facade = context.mock(IJDTFacade.class);
    SessionBeanConverter converter = new SessionBeanConverter(facade);

    // expectations
    context.checking(new Expectations(){{
      one(facade).addMethodAnnotation("test.TestBean", "test", new String[0], ExcludeDefaultInterceptors.class, createNameValuePair("value", new String[] { SessionBeanConverterTest.class.getCanonicalName() })); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
      one(facade).addMethodAnnotation("test.TestBean", "test", new String[0], Interceptors.class, createNameValuePair("value", new String[] { SessionBeanConverterTest.class.getCanonicalName() })); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    }});

    EjbJar ejbJar = new EjbJar();
    EnterpriseBean bean = addStatefulBeanToEjbJar(ejbJar, "TestBean", "test.TestBean"); //$NON-NLS-1$ //$NON-NLS-2$
   
    Interceptor interceptor = new Interceptor(SessionBeanConverterTest.class);
    ejbJar.addInterceptor(interceptor);
    List<InterceptorBinding> interceptorBindings = ejbJar.getAssemblyDescriptor().getInterceptorBinding();
   
    InterceptorBinding binding = new InterceptorBinding(bean, interceptor);
    binding.setExcludeDefaultInterceptors(true);
    NamedMethod method = new NamedMethod();
    method.setMethodName("test"); //$NON-NLS-1$
    method.setMethodParams(new MethodParams());
    binding.setMethod(method);
    interceptorBindings.add(binding);
   
    // execute
    converter.processInterceptors(ejbJar);

    // verify
    context.assertIsSatisfied();
  }
View Full Code Here

  public void testShouldGenerateExcludeClassInterceptorAnnotations() throws Exception {
    // setup
   
    final IJDTFacade facade = context.mock(IJDTFacade.class);
    SessionBeanConverter converter = new SessionBeanConverter(facade);

    // expectations
    context.checking(new Expectations(){{
      one(facade).addClassAnnotation("test.TestBean", Interceptors.class, createNameValuePair("value", new String[] { SessionBeanConverterTest.class.getCanonicalName() })); //$NON-NLS-1$ //$NON-NLS-2$
      one(facade).addClassAnnotation("test.TestBean", ExcludeClassInterceptors.class, createNameValuePair("value", new String[] { SessionBeanConverterTest.class.getCanonicalName() })); //$NON-NLS-1$ //$NON-NLS-2$
    }});

    EjbJar ejbJar = new EjbJar();
    EnterpriseBean bean = addStatefulBeanToEjbJar(ejbJar, "TestBean", "test.TestBean"); //$NON-NLS-1$ //$NON-NLS-2$
   
    Interceptor interceptor = new Interceptor(SessionBeanConverterTest.class);
    ejbJar.addInterceptor(interceptor);
    List<InterceptorBinding> interceptorBindings = ejbJar.getAssemblyDescriptor().getInterceptorBinding();
   
    InterceptorBinding binding = new InterceptorBinding(bean, interceptor);
    binding.setExcludeClassInterceptors(true);
    interceptorBindings.add(binding);
   
    // execute
    converter.processInterceptors(ejbJar);

    // verify
    context.assertIsSatisfied();
  }
View Full Code Here

  public void testShouldGenerateClassExcludeMethodInterceptorAnnotations() throws Exception {
    // setup
   
    final IJDTFacade facade = context.mock(IJDTFacade.class);
    SessionBeanConverter converter = new SessionBeanConverter(facade);

    // expectations
    context.checking(new Expectations(){{
      one(facade).addMethodAnnotation("test.TestBean", "test", new String[0], ExcludeClassInterceptors.class, createNameValuePair("value", new String[] { SessionBeanConverterTest.class.getCanonicalName() })); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
      one(facade).addMethodAnnotation("test.TestBean", "test", new String[0], Interceptors.class, createNameValuePair("value", new String[] { SessionBeanConverterTest.class.getCanonicalName() })); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    }});

    EjbJar ejbJar = new EjbJar();
    EnterpriseBean bean = addStatefulBeanToEjbJar(ejbJar, "TestBean", "test.TestBean"); //$NON-NLS-1$ //$NON-NLS-2$
   
    Interceptor interceptor = new Interceptor(SessionBeanConverterTest.class);
    ejbJar.addInterceptor(interceptor);
    List<InterceptorBinding> interceptorBindings = ejbJar.getAssemblyDescriptor().getInterceptorBinding();
   
    InterceptorBinding binding = new InterceptorBinding(bean, interceptor);
    binding.setExcludeClassInterceptors(true);
    NamedMethod method = new NamedMethod();
    method.setMethodName("test"); //$NON-NLS-1$
    method.setMethodParams(new MethodParams());
    binding.setMethod(method);
    interceptorBindings.add(binding);
   
    // execute
    converter.processInterceptors(ejbJar);

    // verify
    context.assertIsSatisfied();
  }
View Full Code Here

 
  public void testShouldGenerateRemoteAnnotations() throws Exception {
    // setup
   
    final IJDTFacade facade = context.mock(IJDTFacade.class);
    SessionBeanConverter converter = new SessionBeanConverter(facade);

    // expectations
    context.checking(new Expectations(){{
      one(facade).addClassAnnotation("test.TestBean", Stateful.class, null); //$NON-NLS-1$
    }});

    EjbJar ejbJar = new EjbJar();
    StatefulBean bean = (StatefulBean) addStatefulBeanToEjbJar(ejbJar, "TestBean", "test.TestBean"); //$NON-NLS-1$ //$NON-NLS-2$
    bean.setHome("test.TestHome"); //$NON-NLS-1$
    bean.setRemote("test.Test"); //$NON-NLS-1$
   
    // execute
    converter.processSessionBean((SessionBean) bean);

    // verify
    context.assertIsSatisfied();
  }
View Full Code Here

 
  public void testShouldProcessMessageDrivenBean() throws Exception {
    // setup
   
    final IJDTFacade facade = context.mock(IJDTFacade.class);
    SessionBeanConverter converter = new SessionBeanConverter(facade);

    final Map<String,Object> expectedMap = new HashMap<String, Object>();
    expectedMap.put("destination", "TestQueue"); //$NON-NLS-1$ //$NON-NLS-2$
    expectedMap.put("destinationType", "javax.jms.Queue"); //$NON-NLS-1$ //$NON-NLS-2$
   
    // expectations
    context.checking(new Expectations(){{
      one(facade).addClassAnnotation("test.MessageDrivenBean1", MessageDriven.class, createNameValuePair("name", "Test")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    }});

    EjbJar ejbJar = new EjbJar();
    MessageDrivenBean bean = new MessageDrivenBean();
    bean.setEjbName("Test"); //$NON-NLS-1$
    bean.setEjbClass("test.MessageDrivenBean1"); //$NON-NLS-1$
   
    ejbJar.addEnterpriseBean(bean);
   
   
    // execute
    converter.processMessageDrivenBean(bean);

    // verify
    context.assertIsSatisfied();
  }
View Full Code Here

TOP

Related Classes of org.apache.openejb.plugins.common.SessionBeanConverter

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.