Examples of TestBean


Examples of jdk_bug.foo.bean.TestBean

// submitted & found by jswaelens from github
public class Test {

  public static void main(String[] args) {
   
    TestBean b =new TestBean();
    b.doSomething(false);
  }
View Full Code Here

Examples of net.sf.springofeclipse.tests.stubs.TestBean

    BeansExtensionPointBeanDefinitionReader reader = new BeansExtensionPointBeanDefinitionReader(
        context);
    reader.loadBeanDefinitions(context.getId());

    TestBean bean = (TestBean) context.getBean("testBean", TestBean.class);

    assertNotNull(bean);

    assertEquals(context.getBean("testBean2"), bean.getTestBeanProperty());

    assertEquals(-5, bean.getIntProperty());

    assertNotNull(bean.getPropsProperty());

    assertEquals("2", bean.getPropsProperty().getProperty("b"));

    TestBean bean3 = (TestBean) context
        .getBean("testBean3", TestBean.class);

    assertNotNull(bean3);

    assertEquals(58, bean3.getIntProperty());

  }
View Full Code Here

Examples of net.sourceforge.stripes.test.TestBean

    }

    @Test(groups="fast")
    public void testGetPropertyTypeWithBackToBackMapIndexing() {
        PropertyExpression expr = PropertyExpression.getExpression("nestedMap['foo']['bar']");
        PropertyExpressionEvaluation eval = new PropertyExpressionEvaluation(expr, new TestBean());
        Class<?> type = eval.getType();
        Assert.assertEquals(type, Boolean.class);
    }
View Full Code Here

Examples of org.apache.aries.blueprint.testbundleb.TestBean

        assertNotNull(beanContainer);

        //TestBeanA should have the values below, no interference should be present from other sources.
        Object obj1 = beanContainer.getComponentInstance("TestBeanA");
        assertTrue(obj1 instanceof TestBean);
        TestBean testBeanA = (TestBean)obj1;
        org.junit.Assert.assertEquals("RED", testBeanA.getRed());
        org.junit.Assert.assertEquals("GREEN", testBeanA.getGreen());
        org.junit.Assert.assertEquals("BLUE", testBeanA.getBlue());

        //TestBeanB tests that a custom ns handler is able to inject custom components to the blueprint,
        //and modify existing components, and use injected components as modifications.
        Object obj2 = beanContainer.getComponentInstance("TestBeanB");
        assertTrue(obj2 instanceof TestBean);
        TestBean testBeanB = (TestBean)obj2;
        //value should be set in via the added passthroughmetadata via the nshandler.
        org.junit.Assert.assertEquals("ONE_VALUE", testBeanB.getRed());
        org.junit.Assert.assertEquals("GREEN", testBeanB.getGreen());
        org.junit.Assert.assertEquals("BLUE", testBeanB.getBlue());       
       
        //TestBeanC tests that custom ns handlers can add interceptors to beans.
        Object obj3 = beanContainer.getComponentInstance("TestBeanC");
        assertTrue(obj3 instanceof TestBean);
        TestBean testBeanC = (TestBean)obj3;
      
        //handlers are in bundlea, with its own container.
        BlueprintContainer handlerContainer =
            Helper.getBlueprintContainerForBundle( context(), "org.apache.aries.blueprint.testbundlea");
        assertNotNull(handlerContainer);
       
        Object ns1 = handlerContainer.getComponentInstance("NSHandlerOne");
        assertTrue(ns1 instanceof NSHandlerOne);
       
        Object ns2 = handlerContainer.getComponentInstance("NSHandlerTwo");
        assertTrue(ns2 instanceof NSHandlerTwo);
        NSHandlerTwo nstwo = (NSHandlerTwo)ns2;
       
        //now we have a handle to the nshandler2, we can query what it 'saw', and ensure
        //that the interceptors are functioning as expected.
        List<String> log = nstwo.getLog();
       
        //TestBeanC has the interceptor configured, and is injected to OtherBeanA & OtherBeanB
        //which then uses the injected bean during their init method call, to invoke a method
        checkInterceptorLog(new String[] {
        "PRECALL:TestBeanC:methodToInvoke:[RED]:",
        "POSTCALL[true]:TestBeanC:methodToInvoke:[RED]:",
        "PRECALL:TestBeanC:methodToInvoke:[BLUE]:",
        "POSTCALL[false]:TestBeanC:methodToInvoke:[BLUE]:"
         }, log);
       
        //invoking GREEN is hardwired to cause an exception response, we do this
        //from here to ensure the exception occurs and is visible as expected
        RuntimeException re=null;
        try{
          testBeanC.methodToInvoke("GREEN");
        }catch(RuntimeException e){
            re=e;
        }
        assertNotNull("invocation of Green did not cause an exception as expected",re);
       
View Full Code Here

Examples of org.apache.aries.blueprint.testbundleb.TestBean

        assertNotNull(beanContainer);

        //TestBeanA should have the values below, no interference should be present from other sources.
        Object obj1 = beanContainer.getComponentInstance("TestBeanA");
        assertTrue(obj1 instanceof TestBean);
        TestBean testBeanA = (TestBean)obj1;
        org.junit.Assert.assertEquals("RED", testBeanA.getRed());
        org.junit.Assert.assertEquals("GREEN", testBeanA.getGreen());
        org.junit.Assert.assertEquals("BLUE", testBeanA.getBlue());

        //TestBeanB tests that a custom ns handler is able to inject custom components to the blueprint,
        //and modify existing components, and use injected components as modifications.
        Object obj2 = beanContainer.getComponentInstance("TestBeanB");
        assertTrue(obj2 instanceof TestBean);
        TestBean testBeanB = (TestBean)obj2;
        //value should be set in via the added passthroughmetadata via the nshandler.
        org.junit.Assert.assertEquals("ONE_VALUE", testBeanB.getRed());
        org.junit.Assert.assertEquals("GREEN", testBeanB.getGreen());
        org.junit.Assert.assertEquals("BLUE", testBeanB.getBlue());       
       
        //TestBeanC tests that custom ns handlers can add interceptors to beans.
        Object obj3 = beanContainer.getComponentInstance("TestBeanC");
        assertTrue(obj3 instanceof TestBean);
        TestBean testBeanC = (TestBean)obj3;
      
        //handlers are in bundlea, with its own container.
        BlueprintContainer handlerContainer =
            getBlueprintContainerForBundle( bundleContext , "org.apache.aries.blueprint.testbundlea", DEFAULT_TIMEOUT);
        assertNotNull(handlerContainer);
       
        Object ns1 = handlerContainer.getComponentInstance("NSHandlerOne");
        assertTrue(ns1 instanceof NSHandlerOne);
       
        Object ns2 = handlerContainer.getComponentInstance("NSHandlerTwo");
        assertTrue(ns2 instanceof NSHandlerTwo);
        NSHandlerTwo nstwo = (NSHandlerTwo)ns2;
       
        //now we have a handle to the nshandler2, we can query what it 'saw', and ensure
        //that the interceptors are functioning as expected.
        List<String> log = nstwo.getLog();
       
        //TestBeanC has the interceptor configured, and is injected to OtherBeanA & OtherBeanB
        //which then uses the injected bean during their init method call, to invoke a method
        checkInterceptorLog(new String[] {
        "PRECALL:TestBeanC:methodToInvoke:[RED]:",
        "POSTCALL[true]:TestBeanC:methodToInvoke:[RED]:",
        "PRECALL:TestBeanC:methodToInvoke:[BLUE]:",
        "POSTCALL[false]:TestBeanC:methodToInvoke:[BLUE]:"
         }, log);
       
        //invoking GREEN is hardwired to cause an exception response, we do this
        //from here to ensure the exception occurs and is visible as expected
        RuntimeException re=null;
        try{
          testBeanC.methodToInvoke("GREEN");
        }catch(RuntimeException e){
            re=e;
        }
        assertNotNull("invocation of Green did not cause an exception as expected",re);
       
View Full Code Here

Examples of org.apache.aries.transaction.test.TestBean

public class NeverTranAttributeTest extends AbstractIntegrationTest {
 
  @Test
  public void testNever() throws Exception {
      TestBean bean = getOsgiService(TestBean.class, "(tranAttribute=Never)", DEFAULT_TIMEOUT);
      UserTransaction tran = getOsgiService(UserTransaction.class);
     
      //Test with client transaction - an exception is thrown because transactions are not allowed
      int initialRows = bean.countRows();
     
      tran.begin();
     
      try {
          bean.insertRow("testWithClientTran", 1);
          fail("IllegalStateException not thrown");
      } catch (IllegalStateException e) {
          e.printStackTrace();
      }
     
      tran.commit();
     
      int finalRows = bean.countRows();
      assertTrue("Initial rows: " + initialRows + ", Final rows: " + finalRows, finalRows - initialRows == 0);
     
      //Test without client transaction - the insert fails because the bean delegates to another
      //bean with a transaction strategy of Mandatory, and no transaction is available
      initialRows = bean.countRows();

      try {
          bean.insertRow("testWithoutClientTran", 1, true);
          fail("IllegalStateException not thrown");
      } catch (IllegalStateException e) {
          e.printStackTrace();
      }
     
      finalRows = bean.countRows();
      assertTrue("Initial rows: " + initialRows + ", Final rows: " + finalRows, finalRows - initialRows == 0);
  }
View Full Code Here

Examples of org.apache.axis2.jaxws.sample.dlwmin.types.TestBean

     */
    public void testProcess_Echo()  throws Exception {
       
        Greeter proxy = getProxy("process");
       
        TestBean request = new TestBean();
        request.setData1("hello world");
        request.setData2(10);
        TestBean response = proxy.process(0, request);
        assertTrue(response != null);
        assertTrue(response.getData1().equals("hello world"));
        assertTrue(response.getData2() == 10);
    }
View Full Code Here

Examples of org.apache.cayenne.unit.util.TestBean

    }

    public void testEvaluateOBJ_PATH_JavaBean() throws Exception {
        ASTObjPath node = new ASTObjPath("property2");

        TestBean b1 = new TestBean();
        b1.setProperty2(1);
        assertEquals(new Integer(1), node.evaluate(b1));

        TestBean b2 = new TestBean();
        b2.setProperty2(-3);
        assertEquals(new Integer(-3), node.evaluate(b2));
    }
View Full Code Here

Examples of org.apache.cayenne.unit.util.TestBean

        FieldAccessor accessor = new FieldAccessor(TestBean.class, "string", String.class);
        Property property = new SimpleAttributeProperty(d1, accessor, null);

        d1.declaredProperties.put(property.getName(), property);

        TestBean from = new TestBean();
        from.setString("123");

        TestBean to = new TestBean();

        d1.shallowMerge(from, to);
        assertEquals("123", to.getString());
    }
View Full Code Here

Examples of org.apache.cayenne.unit.util.TestBean

        assertSame(object, a.readNestedProperty("someOtherObjectProperty"));
    }

    public void testReadNestedPropertyNonDataObjectPath() {
        CayenneDataObject o1 = new CayenneDataObject();
        TestBean o2 = new TestBean();
        o2.setInteger(new Integer(55));
        o1.writePropertyDirectly("o2", o2);

        assertSame(o2, o1.readNestedProperty("o2"));
        assertEquals(new Integer(55), o1.readNestedProperty("o2.integer"));
        assertEquals(TestBean.class, o1.readNestedProperty("o2.class"));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.