Examples of SimpleBean


Examples of com.drighetto.essai.springaop.bean.SimpleBean

      // Initialize Spring context
      ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
     
      //Get bean from Spring context & call simple bean
      SimpleBean sb = (SimpleBean)context.getBean("simpleBean");
      System.out.println("---[Call method : sb.sayHello(\"Dom\") ]---");
      sb.sayHello("Dom");
      System.out.println("\n---------");
      System.out.println("----------------------------");
      System.out.println("---------\n");
      System.out.println("---[Call method : sb.sayHello() ]---");     
      System.out.println(sb.sayHello());
    } catch (Exception e) {
      e.printStackTrace();
    }

  }
View Full Code Here

Examples of com.github.nmorel.gwtjackson.shared.model.SimpleBean

                "\"longPrimitiveArray2d\":[[9223372036854775807],[-9223372036854775808]]," +
                "\"shortPrimitiveArray2d\":[[9,7,8,15]]," +
                "\"voidProperty\":null" +
                "}";

        SimpleBean bean = reader.read( input );
        assertNotNull( bean );

        assertEquals( "toto", bean.getString() );
        assertEquals( new Integer( 34 ).byteValue(), bean.getBytePrimitive() );
        assertEquals( new Byte( new Integer( 87 ).byteValue() ), bean.getByteBoxed() );
        assertEquals( new Integer( 12 ).shortValue(), bean.getShortPrimitive() );
        assertEquals( new Short( new Integer( 15 ).shortValue() ), bean.getShortBoxed() );
        assertEquals( 234, bean.getIntPrimitive() );
        assertEquals( new Integer( 456 ), bean.getIntBoxed() );
        assertEquals( Long.MIN_VALUE, bean.getLongPrimitive() );
        assertEquals( new Long( Long.MAX_VALUE ), bean.getLongBoxed() );
        assertEquals( 126.23, bean.getDoublePrimitive() );
        assertEquals( 1256.98, bean.getDoubleBoxed() );
        assertEquals( new Double( 12.89 ).floatValue(), bean.getFloatPrimitive() );
        assertEquals( new Double( 67.3 ).floatValue(), bean.getFloatBoxed() );
        assertEquals( new BigDecimal( "12345678987654.456789" ), bean.getBigDecimal() );
        assertEquals( new BigInteger( "123456789098765432345678987654" ), bean.getBigInteger() );
        assertTrue( bean.isBooleanPrimitive() );
        assertFalse( bean.getBooleanBoxed() );
        assertEquals( AnEnum.B, bean.getEnumProperty() );
        assertEquals( '\u00e7', bean.getCharPrimitive() );
        assertEquals( new Character( '\u00e8' ), bean.getCharBoxed() );

        // Date
        assertEquals( new Date( 1345304756543l ), bean.getDate() );
        assertEquals( getUTCTime( 2012, 8, 18, 0, 0, 0, 0 ), bean.getSqlDate().getTime() );
        assertEquals( new Time( 15, 45, 56 ), bean.getSqlTime() );
        assertEquals( new java.sql.Timestamp( 1345304756546l ), bean.getSqlTimestamp() );

        // Arrays
        assertTrue( Arrays.deepEquals( new String[]{"Hello", null, "World", "!"}, bean.getStringArray() ) );
        assertTrue( Arrays.equals( new boolean[]{true, false, false, true, false}, bean.getBooleanPrimitiveArray() ) );
        assertTrue( Arrays.equals( "Hello".getBytes(), bean.getBytePrimitiveArray() ) );
        assertTrue( Arrays.equals( new char[]{'\u00e7', 'o', 'u'}, bean.getCharacterPrimitiveArray() ) );
        assertTrue( Arrays.equals( new double[]{45.789, 0d, 5.1024}, bean.getDoublePrimitiveArray() ) );
        assertTrue( Arrays.equals( new float[]{0f}, bean.getFloatPrimitiveArray() ) );
        assertTrue( Arrays.equals( new int[]{4, 5, 6, 0, 7, 8}, bean.getIntegerPrimitiveArray() ) );
        assertTrue( Arrays.equals( new long[]{Long.MAX_VALUE, 0l, Long.MIN_VALUE}, bean.getLongPrimitiveArray() ) );
        assertTrue( Arrays.equals( new short[]{9, 0, 7, 8, 15}, bean.getShortPrimitiveArray() ) );

        // 2D Arrays
        assertTrue( isArray2dEquals( newArray2d( new String[]{"Jean", "Dujardin"}, new String[]{"Omar", "Sy"}, new String[]{"toto",
                null} ), bean
                .getStringArray2d() ) );
        assertTrue( isArray2dEquals( newArray2d( new boolean[]{true, false}, new boolean[]{false, false} ), bean
                .getBooleanPrimitiveArray2d() ) );
        assertTrue( isArray2dEquals( newArray2d( "Hello".getBytes(), "World".getBytes() ), bean.getBytePrimitiveArray2d() ) );
        assertTrue( isArray2dEquals( newArray2d( new char[]{'\u00e7', 'o'}, new char[]{'a', 'b'} ), bean.getCharacterPrimitiveArray2d() ) );
        assertTrue( isArray2dEquals( newArray2d( new double[]{45.789, 5.1024} ), bean.getDoublePrimitiveArray2d() ) );
        assertTrue( isArray2dEquals( newArray2d( new float[]{} ), bean.getFloatPrimitiveArray2d() ) );
        assertTrue( isArray2dEquals( newArray2d( new int[]{1, 2, 3}, new int[]{4, 5, 6}, new int[]{7, 8, 9} ), bean
                .getIntegerPrimitiveArray2d() ) );
        assertTrue( isArray2dEquals( newArray2d( new long[]{Long.MAX_VALUE}, new long[]{Long.MIN_VALUE} ), bean
                .getLongPrimitiveArray2d() ) );
        assertTrue( isArray2dEquals( newArray2d( new short[]{9, 7, 8, 15} ), bean.getShortPrimitiveArray2d() ) );

        // Void
        assertNull( bean.getVoidProperty() );
    }
View Full Code Here

Examples of org.apache.camel.component.jmx.beans.SimpleBean

    protected void initBean() throws Exception {
        registerBean(createSimpleBean(), makeObjectName("simpleBean"));
    }

    protected SimpleBean createSimpleBean() throws ParseException {
        SimpleBean simpleBean = new SimpleBean();

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-dd-MM'T'HH:mm:ss");
        Date date = sdf.parse("2010-07-01T10:30:15");
        simpleBean.setTimestamp(date.getTime());
        return simpleBean;
    }
View Full Code Here

Examples of org.apache.cxf.aegis.services.SimpleBean

        type.setSchemaType(new QName("urn:Bean", "bean"));

        // Test reading
        ElementReader reader = new ElementReader(getResourceAsStream("bean1.xml"));

        SimpleBean bean = (SimpleBean)type.readObject(reader, getContext());
        assertEquals("bleh", bean.getBleh());
        assertEquals("howdy", bean.getHowdy());

        reader.getXMLStreamReader().close();

        // Test reading with extra elements
        reader = new ElementReader(getResourceAsStream("bean2.xml"));
        bean = (SimpleBean)type.readObject(reader, getContext());
        assertEquals("bleh", bean.getBleh());
        assertEquals("howdy", bean.getHowdy());
        reader.getXMLStreamReader().close();

        // test <bleh/> element
        reader = new ElementReader(getResourceAsStream("bean7.xml"));
        bean = (SimpleBean)type.readObject(reader, getContext());
        assertEquals("", bean.getBleh());
        assertEquals("howdy", bean.getHowdy());
        reader.getXMLStreamReader().close();

        bean.setBleh("bleh");

        // Test writing
        Element element = writeObjectToElement(type, bean, getContext());

        assertValid("/b:root/b:bleh[text()='bleh']", element);
View Full Code Here

Examples of org.apache.myfaces.orchestra.conversation.SimpleBean

        // The Spring configuration for dummyBean does not explicitly set a conversation name,
        // so conversation-name = bean-name
        final String CONVERSATION_NAME = BEAN_NAME;

        // create a proxy (but not the underlying bean)
        SimpleBean proxy = (SimpleBean) applicationContext.getBean(BEAN_NAME);

        assertTrue("should be a scoped object", proxy instanceof ScopedObject);
        assertFalse("conversation should not have been started yet", ConversationManager.getInstance().hasConversation(CONVERSATION_NAME));

        // Invoke a method on the proxy, forcing the real object to be created
        proxy.getData();
        assertTrue("conversation should have been started", ConversationManager.getInstance().hasConversation(CONVERSATION_NAME));

        // Obtain a reference to the real bean. The proxy and real bean will be different objects.
        SimpleBean real = (SimpleBean) _SpringUtils.getRealBean(proxy);
        assertTrue(real != proxy);
       
        // Check that the proxy maps to the real object by modifying via the proxy and reading via
        // the direct reference, and vice-versa
        assertEquals(null, real.getData());
        proxy.setData("proxy");
        assertEquals("proxy", real.getData());
        real.setData("real");
        assertEquals("real", proxy.getData());

        // After invalidating the conversation and recreating the bean, the proxy and
        // real are no longer the same object.
        Conversation conv = ConversationManager.getInstance().getConversation(CONVERSATION_NAME);
        conv.invalidate();
        proxy.setData("proxy");
        assertEquals("real", real.getData());
        real.setData("real");
        assertEquals("proxy", proxy.getData());
    }
View Full Code Here

Examples of org.apache.shindig.protocol.conversion.BeanDelegatorTest.SimpleBean

    assertSame(data, newData);
  }

  @Test
  public void testInt() throws Exception {
    SimpleBean data = new SimpleBean().setI(5);
    SimpleBeanInterface dataBean = (SimpleBeanInterface) beanDelegator.createDelegator(data);

    SimpleBeanInterface newData = (SimpleBeanInterface) beanFilter.createFilteredBean(
        dataBean, ImmutableSet.<String>of("i"));
    assertEquals(5, newData.getI());
View Full Code Here

Examples of org.codehaus.xfire.aegis.type.basic.SimpleBean

//        Client xclient = Client.getInstance(client);
//        xclient.addOutHandler(new DOMOutHandler());
//        xclient.addOutHandler(new LoggingHandler());
//       
        Map map = new HashMap();
        SimpleBean bean = new SimpleBean();
        bean.setHowdy("howdy");
        map.put("test", bean);
        map = client.echoMap(map);
        assertNotNull(map);
        assertEquals(1, map.size());
        bean = (SimpleBean) map.get("test");
        assertNotNull(bean);
        assertEquals("howdy", bean.getHowdy());
       
        MapBean mapBean = new MapBean();
        mapBean.setMap(map);
        MapBean mapBean2 = client.echoMapBean(mapBean);
        assertEquals(1, mapBean2.getMap().size());
View Full Code Here

Examples of org.codehaus.xfire.aegis.type.basic.SimpleBean

        throws WS1Exception
    {
        if (extendedOne)
        {
            WS1Exception ex = new WS1ExtendedException("WS1 extended exception", 20, 30);
            ex.setSimpleBean(new SimpleBean());
            throw ex;
        }
        else
        {
            throw new WS1Exception("WS1 base exception", 10);
View Full Code Here

Examples of org.codehaus.xfire.services.SimpleBean

       
        Object[] response = client.invoke("getSimpleBean", new Object[] {});
        assertNotNull("response from client invoke is null", response);
        assertEquals("unexpected array size in invoke response", 1, response.length);
       
        SimpleBean res = (SimpleBean) response[0];
        assertEquals("bleh", res.getBleh());
    }
View Full Code Here

Examples of org.fimero.core.SimpleBean

  private Environment environment;

  @Bean
  public SimpleBean getSimpleBean() {

    return new SimpleBean(
        this.environment.getProperty("service.message"));
  }
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.