Package org.apache.avalon.meta.info

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


        final EntryDescriptor[] entries =
            buildEntries( info.getChild( "entries" ).getChildren("entry") );
        final String versionString = info.getChild( "version" ).getValue( "1.0" );
        final Version version = buildVersion( versionString );

        return new Service( new ReferenceDescriptor( classname, version ), entries, attributes );
    }
View Full Code Here


    }

    public void setUp()
    {
        m_role = "Test";
        m_reference = new ReferenceDescriptor( DependencyDescriptorTestCase.class.getName(), Version.getVersion( "1.2.1" ) );
    }
View Full Code Here

    public void testConstructor()
    {
        try
        {
            new ReferenceDescriptor(null, m_version);
            fail("Did not throw the expected NullPointerException");
        }
        catch (NullPointerException npe)
        {
            // Success!
        }

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

        ReferenceDescriptor ref = new ReferenceDescriptor( m_classname, m_version );
        checkDescriptor( ref, m_classname, m_version );

        ref = new ReferenceDescriptor( m_classname + ":3.2.1" );
        checkDescriptor( ref, m_classname, Version.getVersion("3.2.1"));
    }
View Full Code Here

        assertEquals(version, ref.getVersion());
    }

    public void testCompliance()
    {
        ReferenceDescriptor ref = new ReferenceDescriptor( m_classname, m_version );
        ReferenceDescriptor any = new ReferenceDescriptor( m_classname, new Version( -1, 0, 0 ) );

        assertTrue( "anything matches explicit", any.matches( ref ) );
        assertFalse( "explicit does not match anything", ref.matches( any ) );
    }
View Full Code Here

        assertFalse( "explicit does not match anything", ref.matches( any ) );
    }

    public void testSerialization() throws IOException, ClassNotFoundException
    {
        ReferenceDescriptor entry = new ReferenceDescriptor( m_classname, m_version );
        checkDescriptor( entry, m_classname, m_version );

        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 ) );
        ReferenceDescriptor serialized = (ReferenceDescriptor) ois.readObject();
        ois.close();
        file.delete();

        checkDescriptor( entry, m_classname, m_version );

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

    {
        final String value = getNamedParameter( tag, TYPE_PARAM );
        final String type = resolveType( value );
        final String versionString = getNamedParameter( tag, VERSION_PARAM, null );
        final Version version = resolveVersion( versionString, value );
        final ReferenceDescriptor ref = new ReferenceDescriptor( type, version );
        return new ServiceDescriptor( ref, null );
    }
View Full Code Here

        return new Service(m_reference, m_entries, getProperties());
    }

    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

TOP

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

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.