mil.dod.th.ose.core.integration/src/mil/dod/th/ose/core/integration/TestObservation.java
public void testValidateObservationSharedType() throws IllegalArgumentException, PersistenceFailedException
    {
        ObservationStore observationStore = 
                ServiceUtils.getService(m_Context, ObservationStore.class);
        
        Observation observation = new Observation();
        // set minimum fields
        observation.setAssetUuid(UUID.randomUUID());
        observation.setAssetName("something");
        observation.setAssetType("something");
        observation.setSystemInTestMode(false);
        observation.setSensorId("something");
        observation.setCreatedTimestamp(3L);
        observation.setUuid(UUID.randomUUID());
        observation.setVersion(new Version(1,2));
        observation.setSystemId(159);
        // DigitalMedia is shared type, encoding must be start with audio/video/image, so this is invalid 
        observation.setDigitalMedia(new DigitalMedia(new byte[] {0, 1, 2}, "invalid encoding"));
        observation.setAudioMetadata(new AudioMetadata().withRecorderType(
                new AudioRecorder().withValue(AudioRecorderEnum.MICROPHONE)));
        
        try
        {
            observationStore.persist(observation);
            fail("Expecting observation to be invalid");
        }
        catch (ValidationFailedException e)
        {
            Logging.log(LogService.LOG_INFO, e, "Validation should fail due to invalid encoding");
        }
    }
/**
     * Validate an observation that has an invalid field, but the schema for the invalid field is in a shared schema. 
     * This tests verifies that the shared schema can be resolved, especially when schema is in a different folder.
     */
Validate an observation that has an invalid field, but the schema for the invalid field is in a shared schema.
This tests verifies that the shared schema can be resolved, especially when schema is in a different folder.
Validate an observation that has an invalid field but the schema for the invalid field is in a shared schema . This tests verifies that the shared schema can be resolved especially when schema is in a different folder .
public void testValidateObservationSharedType() throws IllegalArgumentException, PersistenceFailedException
    {
        ObservationStore observationStore = 
                ServiceUtils.getService(m_Context, ObservationStore.class);
        Observation observation = new Observation();
        observation.setAssetUuid(UUID.randomUUID());
        observation.setAssetName("something");
        observation.setAssetType("something");
        observation.setSystemInTestMode(false);
        observation.setSensorId("something");
        observation.setCreatedTimestamp(3L);
        observation.setUuid(UUID.randomUUID());
        observation.setVersion(new Version(1,2));
        observation.setSystemId(159);
        observation.setDigitalMedia(new DigitalMedia(new byte[] {0, 1, 2}, "invalid encoding"));
        observation.setAudioMetadata(new AudioMetadata().withRecorderType(
                new AudioRecorder().withValue(AudioRecorderEnum.MICROPHONE)));
        try
        {
            observationStore.persist(observation);
            fail("Expecting observation to be invalid");
        }
        catch (ValidationFailedException e)
        {
            Logging.log(LogService.LOG_INFO, e, "Validation should fail due to invalid encoding");
        }
    }
public void testValidateObservationSharedType ( ) throws IllegalArgumentException , PersistenceFailedException { ObservationStore observationStore = ServiceUtils . getService ( m_Context , ObservationStore . class ) ; Observation observation = new Observation ( ) ; observation . setAssetUuid ( UUID . randomUUID ( ) ) ; observation . setAssetName ( "something" ) ; observation . setAssetType ( "something" ) ; observation . setSystemInTestMode ( false ) ; observation . setSensorId ( "something" ) ; observation . setCreatedTimestamp ( 3L ) ; observation . setUuid ( UUID . randomUUID ( ) ) ; observation . setVersion ( new Version ( 1 , 2 ) ) ; observation . setSystemId ( 159 ) ; observation . setDigitalMedia ( new DigitalMedia ( new byte [ ] { 0 , 1 , 2 } , "invalid encoding" ) ) ; observation . setAudioMetadata ( new AudioMetadata ( ) . withRecorderType ( new AudioRecorder ( ) . withValue ( AudioRecorderEnum . MICROPHONE ) ) ) ; try { observationStore . persist ( observation ) ; fail ( "Expecting observation to be invalid" ) ; } catch ( ValidationFailedException e ) { Logging . log ( LogService . LOG_INFO , e , "Validation should fail due to invalid encoding" ) ; } }
Validate an observation that has an invalid field, but the schema for the invalid field is in a shared schema.
Validate an observation that has an invalid field but the schema for the invalid field is in a shared schema .
// set minimum fields // DigitalMedia is shared type, encoding must be start with audio/video/image, so this is invalid 