Package org.apache.avalon.meta.info

Examples of org.apache.avalon.meta.info.EntryDescriptor


            final String type = config.getAttribute( "type", "java.lang.String" );
            final boolean isVolatile = config.getAttributeAsBoolean( "volatile", false );
            final boolean optional =
              config.getAttributeAsBoolean( "optional", false );
            final String alias = config.getAttribute( "alias", null );
            return new EntryDescriptor( key, type, optional, isVolatile, alias );
        }
        catch( Throwable e )
        {
            final String error =
              "Unable to build entry descriptor."
View Full Code Here


    public void setUp()
    {
        m_reference = new ReferenceDescriptor(ServiceTestCase.class.getName(), Version.getVersion("1.2.3"));
        m_entries = new EntryDescriptor[] {
            new EntryDescriptor("key", String.class.getName())
        };
    }
View Full Code Here

        super( name );
    }

    public void testEntryDescriptor()
    {
        EntryDescriptor entry = new EntryDescriptor(m_key, m_type, m_optional, m_volatile, m_alias);
        checkEntry(entry, m_key, m_type, m_optional, m_volatile, m_alias );

        entry = new EntryDescriptor(m_key, m_type);
        checkEntry(entry, m_key, m_type, false, false, null );

        entry = new EntryDescriptor(m_key, m_type, m_optional);
        checkEntry(entry, m_key, m_type, m_optional, false, null );

        entry = new EntryDescriptor( m_key, m_type, m_optional, m_volatile );
        checkEntry( entry, m_key, m_type, m_optional, m_volatile, null );

        try
        {
            new EntryDescriptor(null, m_type);
            fail("Did not throw expected NullPointerException");
        }
        catch(NullPointerException npe)
        {
            // Success!!
        }

        try
        {
            new EntryDescriptor( m_key, null );
            fail( "Did not throw expected NullPointerException" );
        }
        catch ( NullPointerException npe )
        {
            // Success!!
View Full Code Here

        assertEquals( isVolatile, desc.isVolatile() );
    }

    public void testSerialization() throws IOException, ClassNotFoundException
    {
        EntryDescriptor entry = new EntryDescriptor( m_key, m_type, m_optional, m_volatile, m_alias );
        checkEntry( entry, m_key, m_type, m_optional, m_volatile, m_alias );

        File file = new File( "test.out" );
        ObjectOutputStream oos = new ObjectOutputStream( new FileOutputStream( file ) );
        oos.writeObject( entry );
        oos.close();

        ObjectInputStream ois = new ObjectInputStream( new FileInputStream( file ) );
        EntryDescriptor serialized = (EntryDescriptor) ois.readObject();
        ois.close();
        file.delete();

        checkEntry( serialized, m_key, m_type, m_optional, m_volatile, m_alias );

        assertEquals( entry, serialized );
        assertEquals( entry.hashCode(), serialized.hashCode() );
    }
View Full Code Here

    public void testJoin()
    {
        ContextDescriptor desc = (ContextDescriptor) getDescriptor();
        EntryDescriptor[] good = new EntryDescriptor[]{
            new EntryDescriptor( "key", String.class.getName() ),
            new EntryDescriptor( "no conflict", String.class.getName() )
        };
        EntryDescriptor[] bad = new EntryDescriptor[]{
            new EntryDescriptor( "key", Integer.class.getName() )
        };

        checkDescriptor( desc );
        EntryDescriptor[] merged = desc.merge( good );
        checkDescriptor( desc );
View Full Code Here

    public void setUp()
    {
        m_classname = "org.apache.avalon.playground.MyContext";
        m_entries = new EntryDescriptor[]{
            new EntryDescriptor( "key", String.class.getName() )
        };
    }
View Full Code Here

TOP

Related Classes of org.apache.avalon.meta.info.EntryDescriptor

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.