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

        //find the test bundle
        long testBundleId = BundleNamespaceUtils.getBundleBySymbolicName(
                "mil.dod.th.ose.integration.example.metatype", socket);

        //construct request to stop bundle
        StopRequestData request = StopRequestData.newBuilder().setBundleId(testBundleId).build();
        TerraHarvestMessage message = BundleNamespaceUtils.createBundleMessage(request, BundleMessageType.StopRequest);

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

        int regId = RemoteEventRegistration.regRemoteEventMessages(socket, 
                RemoteMetatypeConstants.TOPIC_METATYPE_INFORMATION_AVAILABLE);

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

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

        //going to be at least one because there is the example XML class
        List<MessageDetails> responses = listener.waitForRemoteEvents(
                RemoteMetatypeConstants.TOPIC_METATYPE_INFORMATION_AVAILABLE, TIME_OUT, MatchCount.atLeast(1));
        
        //unreg listener
        MessageListener.unregisterEvent(regId, socket);

        //parse Response
        EventAdminNamespace namespace = (EventAdminNamespace)responses.get(0).getNamespaceMessage();
        SendEventData event = SendEventData.parseFrom(namespace.getData());

        //Look at property keys find the bundle id, this should be the same ID of the bundle that was stopped
        
        Map<String, Object> props = SharedRemoteInterfaceUtils.getSimpleMapFromComplexTypesMap(event.getPropertyList());
        assertThat(props, rawMapHasEntry(RemoteMetatypeConstants.EVENT_PROP_BUNDLE_ID, testBundleId));
    }
/**
     * Test stopping and starting the example asset bundle.
     * Verify Meta type information available event is received with expected information.
     */
Test stopping and starting the example asset bundle.
Verify Meta type information available event is received with expected information.
Test stopping and starting the example asset bundle . Verify Meta type information available event is received with expected information .
@Test
    public void testMetatypeInformationInstalledBundle() throws IOException, InterruptedException
    {
        MessageListener listener = new MessageListener(socket);
        long testBundleId = BundleNamespaceUtils.getBundleBySymbolicName(
                "mil.dod.th.ose.integration.example.metatype", socket);
        StopRequestData request = StopRequestData.newBuilder().setBundleId(testBundleId).build();
        TerraHarvestMessage message = BundleNamespaceUtils.createBundleMessage(request, BundleMessageType.StopRequest);
        message.writeDelimitedTo(socket.getOutputStream());
        int regId = RemoteEventRegistration.regRemoteEventMessages(socket, 
                RemoteMetatypeConstants.TOPIC_METATYPE_INFORMATION_AVAILABLE);
        StartRequestData requestStart = StartRequestData.newBuilder().setBundleId(testBundleId).build();
        message = BundleNamespaceUtils.createBundleMessage(requestStart, BundleMessageType.StartRequest);
        message.writeDelimitedTo(socket.getOutputStream());
        List<MessageDetails> responses = listener.waitForRemoteEvents(
                RemoteMetatypeConstants.TOPIC_METATYPE_INFORMATION_AVAILABLE, TIME_OUT, MatchCount.atLeast(1));
        MessageListener.unregisterEvent(regId, socket);
        EventAdminNamespace namespace = (EventAdminNamespace)responses.get(0).getNamespaceMessage();
        SendEventData event = SendEventData.parseFrom(namespace.getData());
        Map<String, Object> props = SharedRemoteInterfaceUtils.getSimpleMapFromComplexTypesMap(event.getPropertyList());
        assertThat(props, rawMapHasEntry(RemoteMetatypeConstants.EVENT_PROP_BUNDLE_ID, testBundleId));
    }
@ Test public void testMetatypeInformationInstalledBundle ( ) throws IOException , InterruptedException { MessageListener listener = new MessageListener ( socket ) ; long testBundleId = BundleNamespaceUtils . getBundleBySymbolicName ( "mil.dod.th.ose.integration.example.metatype" , socket ) ; StopRequestData request = StopRequestData . newBuilder ( ) . setBundleId ( testBundleId ) . build ( ) ; TerraHarvestMessage message = BundleNamespaceUtils . createBundleMessage ( request , BundleMessageType . StopRequest ) ; message . writeDelimitedTo ( socket . getOutputStream ( ) ) ; int regId = RemoteEventRegistration . regRemoteEventMessages ( socket , RemoteMetatypeConstants . TOPIC_METATYPE_INFORMATION_AVAILABLE ) ; StartRequestData requestStart = StartRequestData . newBuilder ( ) . setBundleId ( testBundleId ) . build ( ) ; message = BundleNamespaceUtils . createBundleMessage ( requestStart , BundleMessageType . StartRequest ) ; message . writeDelimitedTo ( socket . getOutputStream ( ) ) ; List < MessageDetails > responses = listener . waitForRemoteEvents ( RemoteMetatypeConstants . TOPIC_METATYPE_INFORMATION_AVAILABLE , TIME_OUT , MatchCount . atLeast ( 1 ) ) ; MessageListener . unregisterEvent ( regId , socket ) ; EventAdminNamespace namespace = ( EventAdminNamespace ) responses . get ( 0 ) . getNamespaceMessage ( ) ; SendEventData event = SendEventData . parseFrom ( namespace . getData ( ) ) ; Map < String , Object > props = SharedRemoteInterfaceUtils . getSimpleMapFromComplexTypesMap ( event . getPropertyList ( ) ) ; assertThat ( props , rawMapHasEntry ( RemoteMetatypeConstants . EVENT_PROP_BUNDLE_ID , testBundleId ) ) ; }
Test stopping and starting the example asset bundle.
Test stopping and starting the example asset bundle .
//find the test bundle //construct request to stop bundle //send message //construct request to start bundle //send message //going to be at least one because there is the example XML class //unreg listener //parse Response //Look at property keys find the bundle id, this should be the same ID of the bundle that was stopped