mil.dod.th.ose.core.integration/src/mil/dod/th/ose/core/integration/TestAddressedCommandResponse.java
public void testAddressedCommand() throws JAXBException, ValidationFailedException
    {
        UUID uuid = UUID.randomUUID();
        int sourceId = 1;
        int destId = 2;
        UUID assetUuid = UUID.randomUUID();
        SetPanTiltCommand command = new SetPanTiltCommand().withPanTilt(
                SpatialTypesFactory.newOrientationOffset(2.0, 3.0));
        AddressedCommand addrCommand = new AddressedCommand(uuid, sourceId, destId, assetUuid, command);
        XmlMarshalService marshalService = ServiceUtils.getService(m_Context, XmlMarshalService.class);
        byte[] data = marshalService.createXmlByteArray(addrCommand, false);

        XmlUnmarshalService unmarshalService = ServiceUtils.getService(m_Context, XmlUnmarshalService.class);
        AddressedCommand unmarshalledAddrCommand = unmarshalService.getXmlObject(AddressedCommand.class, data);
        assertThat(unmarshalledAddrCommand.getAssetUuid(), is(assetUuid));
        assertThat(unmarshalledAddrCommand.getUuid(), is(uuid));
        assertThat(unmarshalledAddrCommand.getSourceId(), is(sourceId));
        assertThat(unmarshalledAddrCommand.getDestId(), is(destId));
        SetPanTiltCommand unMarshCommand = (SetPanTiltCommand)unmarshalledAddrCommand.getCommand();
        assertThat(unMarshCommand, is(command));
        assertThat(unMarshCommand.getPanTilt().getAzimuth().getValue(), is(2.0));
        assertThat(unMarshCommand.getPanTilt().getElevation().getValue(), is(3.0));

        //try validating
        Validator validator = ServiceUtils.getService(m_Context, Validator.class);
        validator.validate(addrCommand);
    }
/**
     * Test the creation of an {@link AddressedCommand} with a specific type of command.
     * Verify the created object can be marshalled, unmarshalled and validated.
     */
Test the creation of an  AddressedCommand with a specific type of command.
Verify the created object can be marshalled, unmarshalled and validated.
Test the creation of an AddressedCommand with a specific type of command . Verify the created object can be marshalled unmarshalled and validated .
public void testAddressedCommand() throws JAXBException, ValidationFailedException
    {
        UUID uuid = UUID.randomUUID();
        int sourceId = 1;
        int destId = 2;
        UUID assetUuid = UUID.randomUUID();
        SetPanTiltCommand command = new SetPanTiltCommand().withPanTilt(
                SpatialTypesFactory.newOrientationOffset(2.0, 3.0));
        AddressedCommand addrCommand = new AddressedCommand(uuid, sourceId, destId, assetUuid, command);
        XmlMarshalService marshalService = ServiceUtils.getService(m_Context, XmlMarshalService.class);
        byte[] data = marshalService.createXmlByteArray(addrCommand, false);
        XmlUnmarshalService unmarshalService = ServiceUtils.getService(m_Context, XmlUnmarshalService.class);
        AddressedCommand unmarshalledAddrCommand = unmarshalService.getXmlObject(AddressedCommand.class, data);
        assertThat(unmarshalledAddrCommand.getAssetUuid(), is(assetUuid));
        assertThat(unmarshalledAddrCommand.getUuid(), is(uuid));
        assertThat(unmarshalledAddrCommand.getSourceId(), is(sourceId));
        assertThat(unmarshalledAddrCommand.getDestId(), is(destId));
        SetPanTiltCommand unMarshCommand = (SetPanTiltCommand)unmarshalledAddrCommand.getCommand();
        assertThat(unMarshCommand, is(command));
        assertThat(unMarshCommand.getPanTilt().getAzimuth().getValue(), is(2.0));
        assertThat(unMarshCommand.getPanTilt().getElevation().getValue(), is(3.0));
        Validator validator = ServiceUtils.getService(m_Context, Validator.class);
        validator.validate(addrCommand);
    }
public void testAddressedCommand ( ) throws JAXBException , ValidationFailedException { UUID uuid = UUID . randomUUID ( ) ; int sourceId = 1 ; int destId = 2 ; UUID assetUuid = UUID . randomUUID ( ) ; SetPanTiltCommand command = new SetPanTiltCommand ( ) . withPanTilt ( SpatialTypesFactory . newOrientationOffset ( 2.0 , 3.0 ) ) ; AddressedCommand addrCommand = new AddressedCommand ( uuid , sourceId , destId , assetUuid , command ) ; XmlMarshalService marshalService = ServiceUtils . getService ( m_Context , XmlMarshalService . class ) ; byte [ ] data = marshalService . createXmlByteArray ( addrCommand , false ) ; XmlUnmarshalService unmarshalService = ServiceUtils . getService ( m_Context , XmlUnmarshalService . class ) ; AddressedCommand unmarshalledAddrCommand = unmarshalService . getXmlObject ( AddressedCommand . class , data ) ; assertThat ( unmarshalledAddrCommand . getAssetUuid ( ) , is ( assetUuid ) ) ; assertThat ( unmarshalledAddrCommand . getUuid ( ) , is ( uuid ) ) ; assertThat ( unmarshalledAddrCommand . getSourceId ( ) , is ( sourceId ) ) ; assertThat ( unmarshalledAddrCommand . getDestId ( ) , is ( destId ) ) ; SetPanTiltCommand unMarshCommand = ( SetPanTiltCommand ) unmarshalledAddrCommand . getCommand ( ) ; assertThat ( unMarshCommand , is ( command ) ) ; assertThat ( unMarshCommand . getPanTilt ( ) . getAzimuth ( ) . getValue ( ) , is ( 2.0 ) ) ; assertThat ( unMarshCommand . getPanTilt ( ) . getElevation ( ) . getValue ( ) , is ( 3.0 ) ) ; Validator validator = ServiceUtils . getService ( m_Context , Validator . class ) ; validator . validate ( addrCommand ) ; }
Test the creation of an {@link AddressedCommand} with a specific type of command.
Test the creation of an { @link AddressedCommand } with a specific type of command .
//try validating