mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/objectconverter/TestCommandConverterImpl.java
private void assertSingleGetJavaResponseType(CommandResponseEnum commandResponse) 
        throws ObjectConverterException, InvalidProtocolBufferException
    {
        Message commandResponseProto;
        
        switch (commandResponse)
        {
            case GET_CAMERA_SETTINGS_RESPONSE:
                commandResponseProto = GetCameraSettingsResponseGen.GetCameraSettingsResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case GET_POSITION_RESPONSE:
                commandResponseProto = GetPositionResponseGen.GetPositionResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case CAPTURE_IMAGE_RESPONSE:
                commandResponseProto = CaptureImageResponseGen.CaptureImageResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case CONFIGURE_PROFILE_RESPONSE:
                commandResponseProto = ConfigureProfileResponseGen.ConfigureProfileResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case DETECT_TARGET_RESPONSE:
                commandResponseProto = DetectTargetResponseGen.DetectTargetResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case GET_PAN_TILT_RESPONSE:
                commandResponseProto = GetPanTiltResponseGen.GetPanTiltResponse.newBuilder()
                        .setPanTilt(SpatialTypesGen.OrientationOffset.getDefaultInstance())
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case SET_CAMERA_SETTINGS_RESPONSE:
                commandResponseProto = SetCameraSettingsResponseGen.SetCameraSettingsResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case SET_PAN_TILT_RESPONSE:
                commandResponseProto = SetPanTiltResponseGen.SetPanTiltResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case SET_POSITION_RESPONSE:
                commandResponseProto = SetPositionResponseGen.SetPositionResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case GET_VERSION_RESPONSE:
                commandResponseProto = GetVersionResponseGen.GetVersionResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .setCurrentVersion("version")
                        .build();
                break;
            case GET_POINTING_LOCATION_RESPONSE:
                commandResponseProto = GetPointingLocationResponseGen.GetPointingLocationResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .setLocation(Coordinates.newBuilder()
                            .setLongitude(LongitudeWgsDegrees.newBuilder().setValue(1).build())
                            .setLatitude(LatitudeWgsDegrees.newBuilder().setValue(2).build()))
                        .build();
                break;
            case SET_POINTING_LOCATION_RESPONSE:
                commandResponseProto = SetPointingLocationResponseGen.SetPointingLocationResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case GET_TUNE_SETTINGS_RESPONSE:
                commandResponseProto = GetTuneSettingsResponseGen.GetTuneSettingsResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case SET_TUNE_SETTINGS_RESPONSE:
                commandResponseProto = SetTuneSettingsResponseGen.SetTuneSettingsResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case GET_PROFILES_RESPONSE:
                commandResponseProto = GetProfilesResponseGen.GetProfilesResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case GET_MODE_RESPONSE:
                commandResponseProto = GetModeResponseGen.GetModeResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .setMode(Mode.newBuilder().setValue(Mode.Enum.AUTO)
                            .setDescription("mode").build())
                        .build();
                break;
            case SET_MODE_RESPONSE:
                commandResponseProto = SetModeResponseGen.SetModeResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case CREATE_ACTION_LIST_RESPONSE:
                commandResponseProto = CreateActionListResponseGen.CreateActionListResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case TARGET_REFINEMENT_RESPONSE:
                commandResponseProto = TargetRefinementResponseGen.TargetRefinementResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case START_RECORDING_RESPONSE:
                commandResponseProto = StartRecordingResponseGen.StartRecordingResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case STOP_RECORDING_RESPONSE:
                commandResponseProto = StopRecordingResponseGen.StopRecordingResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case GET_LIFT_RESPONSE:
                commandResponseProto = GetLiftResponseGen.GetLiftResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case SET_LIFT_RESPONSE:
                commandResponseProto = SetLiftResponseGen.SetLiftResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case ZEROIZE_RESPONSE:
                commandResponseProto = ZeroizeResponseGen.ZeroizeResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            default:
                fail(String.format("Unit test for Response %s is missing", commandResponse));
                return;
        }
        
        final ExecuteCommandResponseData executeCommandResponseData = 
                ExecuteCommandResponseData.newBuilder().setResponseType(CommandResponseEnumConverter
                        .convertJavaEnumToProto(commandResponse))
                .setResponse(commandResponseProto.toByteString())
                                .setUuid(SharedMessageUtils.convertUUIDToProtoUUID(m_TestUUID)).build();
        
        Response response = m_SUT.getJavaResponseType(
                executeCommandResponseData.getResponse().toByteArray(), commandResponse);
        
        assertThat(response, notNullValue());
    }
/**
     * Tests a single command response type to see if a valid JAXB response can be retrieved.
     * @param commandResponse
     *  the type of command response to retrieve a JAXB response for
     */
Tests a single command response type to see if a valid JAXB response can be retrieved.
@param commandResponse
the type of command response to retrieve a JAXB response for
Tests a single command response type to see if a valid JAXB response can be retrieved . @param commandResponse the type of command response to retrieve a JAXB response for
private void assertSingleGetJavaResponseType(CommandResponseEnum commandResponse) 
        throws ObjectConverterException, InvalidProtocolBufferException
    {
        Message commandResponseProto;
        switch (commandResponse)
        {
            case GET_CAMERA_SETTINGS_RESPONSE:
                commandResponseProto = GetCameraSettingsResponseGen.GetCameraSettingsResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case GET_POSITION_RESPONSE:
                commandResponseProto = GetPositionResponseGen.GetPositionResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case CAPTURE_IMAGE_RESPONSE:
                commandResponseProto = CaptureImageResponseGen.CaptureImageResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case CONFIGURE_PROFILE_RESPONSE:
                commandResponseProto = ConfigureProfileResponseGen.ConfigureProfileResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case DETECT_TARGET_RESPONSE:
                commandResponseProto = DetectTargetResponseGen.DetectTargetResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case GET_PAN_TILT_RESPONSE:
                commandResponseProto = GetPanTiltResponseGen.GetPanTiltResponse.newBuilder()
                        .setPanTilt(SpatialTypesGen.OrientationOffset.getDefaultInstance())
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case SET_CAMERA_SETTINGS_RESPONSE:
                commandResponseProto = SetCameraSettingsResponseGen.SetCameraSettingsResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case SET_PAN_TILT_RESPONSE:
                commandResponseProto = SetPanTiltResponseGen.SetPanTiltResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case SET_POSITION_RESPONSE:
                commandResponseProto = SetPositionResponseGen.SetPositionResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case GET_VERSION_RESPONSE:
                commandResponseProto = GetVersionResponseGen.GetVersionResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .setCurrentVersion("version")
                        .build();
                break;
            case GET_POINTING_LOCATION_RESPONSE:
                commandResponseProto = GetPointingLocationResponseGen.GetPointingLocationResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .setLocation(Coordinates.newBuilder()
                            .setLongitude(LongitudeWgsDegrees.newBuilder().setValue(1).build())
                            .setLatitude(LatitudeWgsDegrees.newBuilder().setValue(2).build()))
                        .build();
                break;
            case SET_POINTING_LOCATION_RESPONSE:
                commandResponseProto = SetPointingLocationResponseGen.SetPointingLocationResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case GET_TUNE_SETTINGS_RESPONSE:
                commandResponseProto = GetTuneSettingsResponseGen.GetTuneSettingsResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case SET_TUNE_SETTINGS_RESPONSE:
                commandResponseProto = SetTuneSettingsResponseGen.SetTuneSettingsResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case GET_PROFILES_RESPONSE:
                commandResponseProto = GetProfilesResponseGen.GetProfilesResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case GET_MODE_RESPONSE:
                commandResponseProto = GetModeResponseGen.GetModeResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .setMode(Mode.newBuilder().setValue(Mode.Enum.AUTO)
                            .setDescription("mode").build())
                        .build();
                break;
            case SET_MODE_RESPONSE:
                commandResponseProto = SetModeResponseGen.SetModeResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case CREATE_ACTION_LIST_RESPONSE:
                commandResponseProto = CreateActionListResponseGen.CreateActionListResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case TARGET_REFINEMENT_RESPONSE:
                commandResponseProto = TargetRefinementResponseGen.TargetRefinementResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case START_RECORDING_RESPONSE:
                commandResponseProto = StartRecordingResponseGen.StartRecordingResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case STOP_RECORDING_RESPONSE:
                commandResponseProto = StopRecordingResponseGen.StopRecordingResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case GET_LIFT_RESPONSE:
                commandResponseProto = GetLiftResponseGen.GetLiftResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case SET_LIFT_RESPONSE:
                commandResponseProto = SetLiftResponseGen.SetLiftResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            case ZEROIZE_RESPONSE:
                commandResponseProto = ZeroizeResponseGen.ZeroizeResponse.newBuilder()
                        .setBase(BaseTypesGen.Response.getDefaultInstance())
                        .build();
                break;
            default:
                fail(String.format("Unit test for Response %s is missing", commandResponse));
                return;
        }
        final ExecuteCommandResponseData executeCommandResponseData = 
                ExecuteCommandResponseData.newBuilder().setResponseType(CommandResponseEnumConverter
                        .convertJavaEnumToProto(commandResponse))
                .setResponse(commandResponseProto.toByteString())
                                .setUuid(SharedMessageUtils.convertUUIDToProtoUUID(m_TestUUID)).build();
        Response response = m_SUT.getJavaResponseType(
                executeCommandResponseData.getResponse().toByteArray(), commandResponse);
        assertThat(response, notNullValue());
    }
private void assertSingleGetJavaResponseType ( CommandResponseEnum commandResponse ) throws ObjectConverterException , InvalidProtocolBufferException { Message commandResponseProto ; switch ( commandResponse ) { case GET_CAMERA_SETTINGS_RESPONSE : commandResponseProto = GetCameraSettingsResponseGen . GetCameraSettingsResponse . newBuilder ( ) . setBase ( BaseTypesGen . Response . getDefaultInstance ( ) ) . build ( ) ; break ; case GET_POSITION_RESPONSE : commandResponseProto = GetPositionResponseGen . GetPositionResponse . newBuilder ( ) . setBase ( BaseTypesGen . Response . getDefaultInstance ( ) ) . build ( ) ; break ; case CAPTURE_IMAGE_RESPONSE : commandResponseProto = CaptureImageResponseGen . CaptureImageResponse . newBuilder ( ) . setBase ( BaseTypesGen . Response . getDefaultInstance ( ) ) . build ( ) ; break ; case CONFIGURE_PROFILE_RESPONSE : commandResponseProto = ConfigureProfileResponseGen . ConfigureProfileResponse . newBuilder ( ) . setBase ( BaseTypesGen . Response . getDefaultInstance ( ) ) . build ( ) ; break ; case DETECT_TARGET_RESPONSE : commandResponseProto = DetectTargetResponseGen . DetectTargetResponse . newBuilder ( ) . setBase ( BaseTypesGen . Response . getDefaultInstance ( ) ) . build ( ) ; break ; case GET_PAN_TILT_RESPONSE : commandResponseProto = GetPanTiltResponseGen . GetPanTiltResponse . newBuilder ( ) . setPanTilt ( SpatialTypesGen . OrientationOffset . getDefaultInstance ( ) ) . setBase ( BaseTypesGen . Response . getDefaultInstance ( ) ) . build ( ) ; break ; case SET_CAMERA_SETTINGS_RESPONSE : commandResponseProto = SetCameraSettingsResponseGen . SetCameraSettingsResponse . newBuilder ( ) . setBase ( BaseTypesGen . Response . getDefaultInstance ( ) ) . build ( ) ; break ; case SET_PAN_TILT_RESPONSE : commandResponseProto = SetPanTiltResponseGen . SetPanTiltResponse . newBuilder ( ) . setBase ( BaseTypesGen . Response . getDefaultInstance ( ) ) . build ( ) ; break ; case SET_POSITION_RESPONSE : commandResponseProto = SetPositionResponseGen . SetPositionResponse . newBuilder ( ) . setBase ( BaseTypesGen . Response . getDefaultInstance ( ) ) . build ( ) ; break ; case GET_VERSION_RESPONSE : commandResponseProto = GetVersionResponseGen . GetVersionResponse . newBuilder ( ) . setBase ( BaseTypesGen . Response . getDefaultInstance ( ) ) . setCurrentVersion ( "version" ) . build ( ) ; break ; case GET_POINTING_LOCATION_RESPONSE : commandResponseProto = GetPointingLocationResponseGen . GetPointingLocationResponse . newBuilder ( ) . setBase ( BaseTypesGen . Response . getDefaultInstance ( ) ) . setLocation ( Coordinates . newBuilder ( ) . setLongitude ( LongitudeWgsDegrees . newBuilder ( ) . setValue ( 1 ) . build ( ) ) . setLatitude ( LatitudeWgsDegrees . newBuilder ( ) . setValue ( 2 ) . build ( ) ) ) . build ( ) ; break ; case SET_POINTING_LOCATION_RESPONSE : commandResponseProto = SetPointingLocationResponseGen . SetPointingLocationResponse . newBuilder ( ) . setBase ( BaseTypesGen . Response . getDefaultInstance ( ) ) . build ( ) ; break ; case GET_TUNE_SETTINGS_RESPONSE : commandResponseProto = GetTuneSettingsResponseGen . GetTuneSettingsResponse . newBuilder ( ) . setBase ( BaseTypesGen . Response . getDefaultInstance ( ) ) . build ( ) ; break ; case SET_TUNE_SETTINGS_RESPONSE : commandResponseProto = SetTuneSettingsResponseGen . SetTuneSettingsResponse . newBuilder ( ) . setBase ( BaseTypesGen . Response . getDefaultInstance ( ) ) . build ( ) ; break ; case GET_PROFILES_RESPONSE : commandResponseProto = GetProfilesResponseGen . GetProfilesResponse . newBuilder ( ) . setBase ( BaseTypesGen . Response . getDefaultInstance ( ) ) . build ( ) ; break ; case GET_MODE_RESPONSE : commandResponseProto = GetModeResponseGen . GetModeResponse . newBuilder ( ) . setBase ( BaseTypesGen . Response . getDefaultInstance ( ) ) . setMode ( Mode . newBuilder ( ) . setValue ( Mode . Enum . AUTO ) . setDescription ( "mode" ) . build ( ) ) . build ( ) ; break ; case SET_MODE_RESPONSE : commandResponseProto = SetModeResponseGen . SetModeResponse . newBuilder ( ) . setBase ( BaseTypesGen . Response . getDefaultInstance ( ) ) . build ( ) ; break ; case CREATE_ACTION_LIST_RESPONSE : commandResponseProto = CreateActionListResponseGen . CreateActionListResponse . newBuilder ( ) . setBase ( BaseTypesGen . Response . getDefaultInstance ( ) ) . build ( ) ; break ; case TARGET_REFINEMENT_RESPONSE : commandResponseProto = TargetRefinementResponseGen . TargetRefinementResponse . newBuilder ( ) . setBase ( BaseTypesGen . Response . getDefaultInstance ( ) ) . build ( ) ; break ; case START_RECORDING_RESPONSE : commandResponseProto = StartRecordingResponseGen . StartRecordingResponse . newBuilder ( ) . setBase ( BaseTypesGen . Response . getDefaultInstance ( ) ) . build ( ) ; break ; case STOP_RECORDING_RESPONSE : commandResponseProto = StopRecordingResponseGen . StopRecordingResponse . newBuilder ( ) . setBase ( BaseTypesGen . Response . getDefaultInstance ( ) ) . build ( ) ; break ; case GET_LIFT_RESPONSE : commandResponseProto = GetLiftResponseGen . GetLiftResponse . newBuilder ( ) . setBase ( BaseTypesGen . Response . getDefaultInstance ( ) ) . build ( ) ; break ; case SET_LIFT_RESPONSE : commandResponseProto = SetLiftResponseGen . SetLiftResponse . newBuilder ( ) . setBase ( BaseTypesGen . Response . getDefaultInstance ( ) ) . build ( ) ; break ; case ZEROIZE_RESPONSE : commandResponseProto = ZeroizeResponseGen . ZeroizeResponse . newBuilder ( ) . setBase ( BaseTypesGen . Response . getDefaultInstance ( ) ) . build ( ) ; break ; default : fail ( String . format ( "Unit test for Response %s is missing" , commandResponse ) ) ; return ; } final ExecuteCommandResponseData executeCommandResponseData = ExecuteCommandResponseData . newBuilder ( ) . setResponseType ( CommandResponseEnumConverter . convertJavaEnumToProto ( commandResponse ) ) . setResponse ( commandResponseProto . toByteString ( ) ) . setUuid ( SharedMessageUtils . convertUUIDToProtoUUID ( m_TestUUID ) ) . build ( ) ; Response response = m_SUT . getJavaResponseType ( executeCommandResponseData . getResponse ( ) . toByteArray ( ) , commandResponse ) ; assertThat ( response , notNullValue ( ) ) ; }
Tests a single command response type to see if a valid JAXB response can be retrieved.
Tests a single command response type to see if a valid JAXB response can be retrieved .