Examples of BeanContextSupport


Examples of java.beans.beancontext.BeanContextSupport

    }

    public void testInstantiateClassLoaderStringBeanContextAppletInitializer_BeanNull()
            throws Exception {
        ClassLoader loader = createSpecificClassLoader();
        BeanContext context = new BeanContextSupport();
        AppletInitializer appInit = new MockAppletInitializer();

        try {
            Beans.instantiate(loader, null, context, appInit);
            fail("Should throw NullPointerException.");
View Full Code Here

Examples of java.beans.beancontext.BeanContextSupport

    public void testInstantiateClassLoaderStringBeanContextAppletInitializer_InitializerNull()
            throws Exception {
        ClassLoader loader = createSpecificClassLoader();
        String beanName = "org.apache.harmony.beans.tests.support.mock.MockJavaBean";
        BeanContext context = new BeanContextSupport();
        Object bean = Beans.instantiate(loader, beanName, context, null);

        assertSame(ClassLoader.getSystemClassLoader(), bean.getClass()
                .getClassLoader());
        assertEquals(beanName, bean.getClass().getName());
View Full Code Here

Examples of java.beans.beancontext.BeanContextSupport

        final String RESOURCE_NAME = "org/apache/harmony/beans/tests/support/beancontext/mock/mockdata.txt";
        URL url = support.getResource(RESOURCE_NAME, child);
        assertTrue(url.toString().endsWith(RESOURCE_NAME));
       
        BeanContextSupport beanContextSupport = new BeanContextSupport();
        beanContextSupport.add(child);
        url = beanContextSupport.getResource(RESOURCE_NAME, child);
        assertTrue(url.toString().endsWith(RESOURCE_NAME));
    }
View Full Code Here

Examples of java.beans.beancontext.BeanContextSupport

        // covered by testReadChildren()
    }

    public void testSerialization_NoPeer() throws IOException,
            ClassNotFoundException {
        BeanContextSupport support = new BeanContextSupport(null, Locale.ITALY,
                true, true);
        support
                .addBeanContextMembershipListener(new MockBeanContextMembershipListener());
        support
                .addBeanContextMembershipListener(new MockBeanContextMembershipListenerS(
                        "l2"));
        support
                .addBeanContextMembershipListener(new MockBeanContextMembershipListenerS(
                        "l3"));
        support
                .addBeanContextMembershipListener(new MockBeanContextMembershipListener());
        support.add("abcd");
        support.add(new MockBeanContextChild());
        support.add(new MockBeanContextChildS("a child"));
        support.add(new MockBeanContextChild());
        support.add("1234");
        support.add(new MockBeanContextProxyS("proxy",
                new MockBeanContextChildS("b child")));

        assertEqualsSerially(support, (BeanContextSupport) SerializationTester
                .getDeserilizedObject(support));
    }
View Full Code Here

Examples of java.beans.beancontext.BeanContextSupport

    }

    public void testSerialization_Peer() throws IOException,
            ClassNotFoundException {
        MockBeanContextDelegateS mock = new MockBeanContextDelegateS("main id");
        BeanContextSupport support = mock.support;
        support
                .addBeanContextMembershipListener(new MockBeanContextMembershipListener());
        support
                .addBeanContextMembershipListener(new MockBeanContextMembershipListenerS(
                        "l2"));
        support
                .addBeanContextMembershipListener(new MockBeanContextMembershipListenerS(
                        "l3"));
        support
                .addBeanContextMembershipListener(new MockBeanContextMembershipListener());
        support.add("abcd");
        support.add(new MockBeanContextChild());
        support.add(new MockBeanContextChildS("a child"));
        support.add(new MockBeanContextChild());
        support.add("1234");
        support.add(new MockBeanContextProxyS("proxy",
                new MockBeanContextChildS("b child")));

        MockBeanContextDelegateS serMock = (MockBeanContextDelegateS) SerializationTester
                .getDeserilizedObject(mock);
        assertEquals(mock.id, serMock.id);
View Full Code Here

Examples of java.beans.beancontext.BeanContextSupport

        assertEqualsSerially(mock.support, serMock.support);
    }

     public void testSerialization_Compatibility() throws Exception {
         MockBeanContextDelegateS mock = new MockBeanContextDelegateS("main id");
         BeanContextSupport support = mock.support;
         support.addBeanContextMembershipListener(new MockBeanContextMembershipListener());
         support.addBeanContextMembershipListener(new MockBeanContextMembershipListenerS("l2"));
         support.addBeanContextMembershipListener(new MockBeanContextMembershipListenerS("l3"));
         support.addBeanContextMembershipListener(new MockBeanContextMembershipListener());
         support.add("abcd");
         support.add(new MockBeanContextChild());
         support.add(new MockBeanContextChildS("a child"));
         support.add(new MockBeanContextChild());
         support.add("1234");
         SerializationTest.verifyGolden(this, mock, new SerializableAssert(){
             public void assertDeserialized(Serializable orig, Serializable ser) {
                 MockBeanContextDelegateS serMock = (MockBeanContextDelegateS) ser;
                 MockBeanContextDelegateS mock = (MockBeanContextDelegateS) orig;
                 assertEquals(mock.id, serMock.id);
View Full Code Here

Examples of java.beans.beancontext.BeanContextSupport

        p.firePropertyChange(null, new Object(), new Object());
    }
   
    //Regression Test for HARMONY-3757
    public void testSelfSerializatoin() throws Exception {
        BeanContextSupport beanContextSupport = new BeanContextSupport();
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        new ObjectOutputStream(baos).writeObject(beanContextSupport);
        ObjectInputStream oin = new ObjectInputStream(new ByteArrayInputStream(
                baos.toByteArray()));
        Object obj = oin.readObject();
View Full Code Here

Examples of java.beans.beancontext.BeanContextSupport

        final String RESOURCE_NAME = "org/apache/harmony/beans/tests/support/beancontext/mock/mockdata.txt";
        URL url = support.getResource(RESOURCE_NAME, child);
        assertTrue(url.toString().endsWith(RESOURCE_NAME));
       
        BeanContextSupport beanContextSupport = new BeanContextSupport();
        beanContextSupport.add(child);
        url = beanContextSupport.getResource(RESOURCE_NAME, child);
        assertTrue(url.toString().endsWith(RESOURCE_NAME));
    }
View Full Code Here

Examples of java.beans.beancontext.BeanContextSupport

        assertEquals(3, support.size());
        support.records.assertEndOfRecords();
    }

    public void test_readChildren_NPE_scenario1() throws Exception {
        BeanContextSupport beanContextSupport = new BeanContextSupport();
        beanContextSupport.add(beanContextSupport);
        assertEquals(1, beanContextSupport.size());
        assertFalse(beanContextSupport.isSerializing());
        try {
            beanContextSupport.readChildren((ObjectInputStream) null);
            fail("should throw NullPointerException");
        } catch (NullPointerException e) {
            // Expected
        }
    }
View Full Code Here

Examples of java.beans.beancontext.BeanContextSupport

            // Expected
        }
    }

    public void test_readChildren_NPE_scenario2() throws Exception {
        BeanContextSupport beanContextSupport = new BeanContextSupport();
        beanContextSupport.readChildren((ObjectInputStream) null);
    }
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.