mil.dod.th.ose.remote.integration/src/mil/dod/th/ose/remote/integration/base/TestMetatypeInformationListener.java
@Test
    public void testMetatypeInformationTestBundle() throws IOException, InterruptedException
    {
        MessageListener listener = new MessageListener(socket);

        //install test bundle
        final long testBundleId = BundleNamespaceUtils.installBundle(
                ResourceUtils.getExampleProjectBundleFile(), "test.RemoteInterface.bundle", false, socket);

        //register to listen to event
        int regId = RemoteEventRegistration.regRemoteEventMessages(
             socket, RemoteMetatypeConstants.TOPIC_METATYPE_INFORMATION_AVAILABLE);

        //construct request to start bundle
        StartRequestData requestStart = StartRequestData.newBuilder().setBundleId(testBundleId).build();
        TerraHarvestMessage message = 
                BundleNamespaceUtils.createBundleMessage(requestStart, BundleMessageType.StartRequest);

        //send message
        message.writeDelimitedTo(socket.getOutputStream());

        //listen for response
        try
        {
            listener.waitForMessage(Namespace.EventAdmin, EventAdminMessageType.SendEvent, TIME_OUT);
            fail("Expected exception because we do not expect a message.");
        }
        catch (AssertionError e)
        {
            //expecting exception
        }

        //unreg listener
        MessageListener.unregisterEvent(regId, socket);

        //uninstall bundle
        BundleNamespaceUtils.uninstallBundle(testBundleId, socket);
    }
/**
     * Test starting and stopping a bundle that does not have metatype information.
     * Verify Meta type information available event is NOT received from the metatype listener.
     */
Test starting and stopping a bundle that does not have metatype information.
Verify Meta type information available event is NOT received from the metatype listener.
Test starting and stopping a bundle that does not have metatype information . Verify Meta type information available event is NOT received from the metatype listener .
@Test
    public void testMetatypeInformationTestBundle() throws IOException, InterruptedException
    {
        MessageListener listener = new MessageListener(socket);
        final long testBundleId = BundleNamespaceUtils.installBundle(
                ResourceUtils.getExampleProjectBundleFile(), "test.RemoteInterface.bundle", false, socket);
        int regId = RemoteEventRegistration.regRemoteEventMessages(
             socket, RemoteMetatypeConstants.TOPIC_METATYPE_INFORMATION_AVAILABLE);
        StartRequestData requestStart = StartRequestData.newBuilder().setBundleId(testBundleId).build();
        TerraHarvestMessage message = 
                BundleNamespaceUtils.createBundleMessage(requestStart, BundleMessageType.StartRequest);
        message.writeDelimitedTo(socket.getOutputStream());
        try
        {
            listener.waitForMessage(Namespace.EventAdmin, EventAdminMessageType.SendEvent, TIME_OUT);
            fail("Expected exception because we do not expect a message.");
        }
        catch (AssertionError e)
        {
        }
        MessageListener.unregisterEvent(regId, socket);
        BundleNamespaceUtils.uninstallBundle(testBundleId, socket);
    }
@ Test public void testMetatypeInformationTestBundle ( ) throws IOException , InterruptedException { MessageListener listener = new MessageListener ( socket ) ; final long testBundleId = BundleNamespaceUtils . installBundle ( ResourceUtils . getExampleProjectBundleFile ( ) , "test.RemoteInterface.bundle" , false , socket ) ; int regId = RemoteEventRegistration . regRemoteEventMessages ( socket , RemoteMetatypeConstants . TOPIC_METATYPE_INFORMATION_AVAILABLE ) ; StartRequestData requestStart = StartRequestData . newBuilder ( ) . setBundleId ( testBundleId ) . build ( ) ; TerraHarvestMessage message = BundleNamespaceUtils . createBundleMessage ( requestStart , BundleMessageType . StartRequest ) ; message . writeDelimitedTo ( socket . getOutputStream ( ) ) ; try { listener . waitForMessage ( Namespace . EventAdmin , EventAdminMessageType . SendEvent , TIME_OUT ) ; fail ( "Expected exception because we do not expect a message." ) ; } catch ( AssertionError e ) { } MessageListener . unregisterEvent ( regId , socket ) ; BundleNamespaceUtils . uninstallBundle ( testBundleId , socket ) ; }
Test starting and stopping a bundle that does not have metatype information.
Test starting and stopping a bundle that does not have metatype information .
//install test bundle //register to listen to event //construct request to start bundle //send message //listen for response //expecting exception //unreg listener //uninstall bundle