Package java.beans.beancontext

Examples of java.beans.beancontext.BeanContextSupport$BCSChild


    }

    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


    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

     * Test method setBeanContext() with BeanContext parameter.
     * <p>
     */
    public void testSetBeanContextBeanContext() throws Exception {
        BeanContextChildSupport sup = new BeanContextChildSupport();
        sup.setBeanContext(new BeanContextSupport());

        assertNotNull("BeanContext should not be null", sup.getBeanContext());
    }
View Full Code Here

    public void testSetBeanContextBeanContextWithPropertyVetoException()
            throws Exception {
        MyBeanContextChildSupport myBeanContextChildSupport = new MyBeanContextChildSupport();
        VetoableChangeListener vcl = new MyVetoableChangeListener();
        myBeanContextChildSupport.addVetoableChangeListener("beanContext", vcl);
        BeanContext beanContext = new BeanContextSupport();
        try {
            myBeanContextChildSupport.setBeanContext(beanContext);
            fail("should throw PropertyVetoException");
        } catch (PropertyVetoException e) {          
            // expected
        }
        assertTrue(myBeanContextChildSupport.getRejectedSetBCOnce());
        assertNull(myBeanContextChildSupport.getBeanContext());
       
        myBeanContextChildSupport.setBeanContext(beanContext);
        assertFalse(myBeanContextChildSupport.getRejectedSetBCOnce());
        assertNotNull(myBeanContextChildSupport.getBeanContext());
       
        try {
            myBeanContextChildSupport.setBeanContext(new BeanContextSupport());
            fail("should throw PropertyVetoException");
        } catch (PropertyVetoException e) {
            // expected
        }
       
View Full Code Here

   
    //Regression for HARMONY-3774.
    public void test_setLocale_null() throws Exception
    {
        Locale locale = Locale.FRANCE;
        BeanContextSupport beanContextSupport = new BeanContextSupport(null, locale);
        assertEquals(Locale.FRANCE, beanContextSupport.getLocale());
        MyPropertyChangeListener myPropertyChangeListener = new MyPropertyChangeListener();
        beanContextSupport.addPropertyChangeListener("locale", myPropertyChangeListener);
        beanContextSupport.setLocale(null);
        assertEquals(Locale.FRANCE, beanContextSupport.getLocale());
        assertFalse(myPropertyChangeListener.changed);       
    }
View Full Code Here

    /**
     * Regression test for HARMONY-4011
     */
    public void test4011() {
        BeanContextSupport context = new BeanContextSupport();
        final int[] k = { 0 };
        BeanContextMembershipListener listener =
                new BeanContextMembershipListener() {
                   
            public void childrenAdded(BeanContextMembershipEvent bcme) {
                k[0]++;
            }

            public void childrenRemoved(BeanContextMembershipEvent bcme) {}
        };

        // add listener
        context.addBeanContextMembershipListener(listener);
        context.add(new BeanContextChildSupport());
        assertEquals(1, k[0]);
       
        // add the same listener onse again
        context.addBeanContextMembershipListener(listener);
        context.add(new BeanContextChildSupport());
        assertEquals(2, k[0]);
    }
View Full Code Here

        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

        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

                return childSupport;
            }
        }
       
        // Regression test for HARMONY-1829
        BeanContextSupport obj = new BeanContextSupport();
        obj.add(new TestBean());
        assertEquals(2, obj.size());
    }
View Full Code Here

        // 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

TOP

Related Classes of java.beans.beancontext.BeanContextSupport$BCSChild

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.