mil.dod.th.ose.core/test/mil/dod/th/ose/core/impl/asset/data/TestAssetFactoryObjectDataManagerImpl.java
@Test
    public void testSetCoordinatesBySensorId() throws FactoryObjectInformationException, ObjectConverterException, 
        IllegalArgumentException, PersistenceFailedException, InvalidProtocolBufferException, ValidationFailedException
    {
        //activate to create converters 
        m_SUT.activate();
        
        //persisted message with additional entry
        m_ProtoCoorsList.add(CoordinatesEntry.newBuilder()
                .setKey("example-sensor-id")
                .setValue(m_ProtoCoors2)
                .build());
        m_CoordsMap.put("example-sensor-id", m_Coordinates2);
        m_FactData = FactoryObjectData.newBuilder().
                setName("original").build();
        when(m_PersistentData.getEntity()).thenReturn(m_FactData.toByteArray());
        when(m_PersistentData.getUUID()).thenReturn(m_UUID);
        
        when(m_PersistentDataStore.find(m_UUID)).thenReturn(m_PersistentData);

        when(m_JaxbConverter.convertToProto(m_Coordinates)).thenReturn(m_ProtoCoors);
        when(m_JaxbConverter.convertToProto(m_Coordinates2)).thenReturn(m_ProtoCoors2);
        
        m_SUT.setCoordinates(m_UUID, m_CoordsMap);
        
        //verify
        ArgumentCaptor<byte[]> pDataCaptor = ArgumentCaptor.forClass(byte[].class);
        verify(m_PersistentData).setEntity(pDataCaptor.capture());
        verify(m_PersistentDataStore).merge(m_PersistentData);
        
        byte[] byteData = pDataCaptor.getValue();
        
        FactoryObjectData captMessage = FactoryObjectData.parseFrom(byteData, m_SUT.getRegistry());
        
        List<CoordinatesEntry> coordCapt = captMessage.getExtension(AssetObjectData.coordinates);
        assertThat(coordCapt, is(m_ProtoCoorsList));
    }
/**
     * Verify setting of coordinates for an asset when using a sensor ID.
     */
Verify setting of coordinates for an asset when using a sensor ID.
Verify setting of coordinates for an asset when using a sensor ID .
@Test
    public void testSetCoordinatesBySensorId() throws FactoryObjectInformationException, ObjectConverterException, 
        IllegalArgumentException, PersistenceFailedException, InvalidProtocolBufferException, ValidationFailedException
    {
        m_SUT.activate();
        m_ProtoCoorsList.add(CoordinatesEntry.newBuilder()
                .setKey("example-sensor-id")
                .setValue(m_ProtoCoors2)
                .build());
        m_CoordsMap.put("example-sensor-id", m_Coordinates2);
        m_FactData = FactoryObjectData.newBuilder().
                setName("original").build();
        when(m_PersistentData.getEntity()).thenReturn(m_FactData.toByteArray());
        when(m_PersistentData.getUUID()).thenReturn(m_UUID);
        when(m_PersistentDataStore.find(m_UUID)).thenReturn(m_PersistentData);
        when(m_JaxbConverter.convertToProto(m_Coordinates)).thenReturn(m_ProtoCoors);
        when(m_JaxbConverter.convertToProto(m_Coordinates2)).thenReturn(m_ProtoCoors2);
        m_SUT.setCoordinates(m_UUID, m_CoordsMap);
        ArgumentCaptor<byte[]> pDataCaptor = ArgumentCaptor.forClass(byte[].class);
        verify(m_PersistentData).setEntity(pDataCaptor.capture());
        verify(m_PersistentDataStore).merge(m_PersistentData);
        byte[] byteData = pDataCaptor.getValue();
        FactoryObjectData captMessage = FactoryObjectData.parseFrom(byteData, m_SUT.getRegistry());
        List<CoordinatesEntry> coordCapt = captMessage.getExtension(AssetObjectData.coordinates);
        assertThat(coordCapt, is(m_ProtoCoorsList));
    }
@ Test public void testSetCoordinatesBySensorId ( ) throws FactoryObjectInformationException , ObjectConverterException , IllegalArgumentException , PersistenceFailedException , InvalidProtocolBufferException , ValidationFailedException { m_SUT . activate ( ) ; m_ProtoCoorsList . add ( CoordinatesEntry . newBuilder ( ) . setKey ( "example-sensor-id" ) . setValue ( m_ProtoCoors2 ) . build ( ) ) ; m_CoordsMap . put ( "example-sensor-id" , m_Coordinates2 ) ; m_FactData = FactoryObjectData . newBuilder ( ) . setName ( "original" ) . build ( ) ; when ( m_PersistentData . getEntity ( ) ) . thenReturn ( m_FactData . toByteArray ( ) ) ; when ( m_PersistentData . getUUID ( ) ) . thenReturn ( m_UUID ) ; when ( m_PersistentDataStore . find ( m_UUID ) ) . thenReturn ( m_PersistentData ) ; when ( m_JaxbConverter . convertToProto ( m_Coordinates ) ) . thenReturn ( m_ProtoCoors ) ; when ( m_JaxbConverter . convertToProto ( m_Coordinates2 ) ) . thenReturn ( m_ProtoCoors2 ) ; m_SUT . setCoordinates ( m_UUID , m_CoordsMap ) ; ArgumentCaptor < byte [ ] > pDataCaptor = ArgumentCaptor . forClass ( byte [ ] . class ) ; verify ( m_PersistentData ) . setEntity ( pDataCaptor . capture ( ) ) ; verify ( m_PersistentDataStore ) . merge ( m_PersistentData ) ; byte [ ] byteData = pDataCaptor . getValue ( ) ; FactoryObjectData captMessage = FactoryObjectData . parseFrom ( byteData , m_SUT . getRegistry ( ) ) ; List < CoordinatesEntry > coordCapt = captMessage . getExtension ( AssetObjectData . coordinates ) ; assertThat ( coordCapt , is ( m_ProtoCoorsList ) ) ; }
Verify setting of coordinates for an asset when using a sensor ID.
Verify setting of coordinates for an asset when using a sensor ID .
//activate to create converters  //persisted message with additional entry //verify