mil.dod.th.ose.core.integration/src/mil/dod/th/ose/core/integration/TestObservation.java
public void testObsDupDigitalMedia() throws PersistenceFailedException, ValidationFailedException
    {
        ImageMetadata imgMetaData1 = new ImageMetadata()
                .withCaptureTime(50L)
                .withMaskSamplesOfInterest(m_DigitalMedia1, m_DigitalMedia2)
                .withImager(new Camera(1, "Camera1", CameraTypeEnum.VISIBLE))
                .withImageCaptureReason(new ImageCaptureReason(ImageCaptureReasonEnum.OTHER, "reason1"));

        // Persist the first observation
        m_PersistedObservation = createBaseObservation();
        m_PersistedObservation.setDigitalMedia(m_DigitalMedia1);
        m_PersistedObservation.setImageMetadata(imgMetaData1);
        m_ObservationStore.persist(m_PersistedObservation);

        ImageMetadata imgMetaData2 = new ImageMetadata()
                .withCaptureTime(100L)
                .withMaskSamplesOfInterest(m_DigitalMedia1, m_DigitalMedia2)
                .withImager(new Camera(1, "Camera1", CameraTypeEnum.VISIBLE))
                .withImageCaptureReason(new ImageCaptureReason(ImageCaptureReasonEnum.OTHER, "reason2"));

        // Persist second observation containing some duplicate data
        Observation observation = createBaseObservation();
        observation.setDigitalMedia(m_DigitalMedia1);
        observation.setImageMetadata(imgMetaData2);
        m_ObservationStore.persist(observation);
        m_ObservationStore.remove(observation);

        // Verify that all data exists for the first observation persisted
        observation = m_ObservationStore.find(m_PersistedObservation.getUuid());
        assertEquals(m_PersistedObservation, observation);
    }
/**
     * Make sure that observations with duplicate media data can be persisted and deleted.
     */
Make sure that observations with duplicate media data can be persisted and deleted.
Make sure that observations with duplicate media data can be persisted and deleted .
public void testObsDupDigitalMedia() throws PersistenceFailedException, ValidationFailedException
    {
        ImageMetadata imgMetaData1 = new ImageMetadata()
                .withCaptureTime(50L)
                .withMaskSamplesOfInterest(m_DigitalMedia1, m_DigitalMedia2)
                .withImager(new Camera(1, "Camera1", CameraTypeEnum.VISIBLE))
                .withImageCaptureReason(new ImageCaptureReason(ImageCaptureReasonEnum.OTHER, "reason1"));
        m_PersistedObservation = createBaseObservation();
        m_PersistedObservation.setDigitalMedia(m_DigitalMedia1);
        m_PersistedObservation.setImageMetadata(imgMetaData1);
        m_ObservationStore.persist(m_PersistedObservation);
        ImageMetadata imgMetaData2 = new ImageMetadata()
                .withCaptureTime(100L)
                .withMaskSamplesOfInterest(m_DigitalMedia1, m_DigitalMedia2)
                .withImager(new Camera(1, "Camera1", CameraTypeEnum.VISIBLE))
                .withImageCaptureReason(new ImageCaptureReason(ImageCaptureReasonEnum.OTHER, "reason2"));
        Observation observation = createBaseObservation();
        observation.setDigitalMedia(m_DigitalMedia1);
        observation.setImageMetadata(imgMetaData2);
        m_ObservationStore.persist(observation);
        m_ObservationStore.remove(observation);
        observation = m_ObservationStore.find(m_PersistedObservation.getUuid());
        assertEquals(m_PersistedObservation, observation);
    }
public void testObsDupDigitalMedia ( ) throws PersistenceFailedException , ValidationFailedException { ImageMetadata imgMetaData1 = new ImageMetadata ( ) . withCaptureTime ( 50L ) . withMaskSamplesOfInterest ( m_DigitalMedia1 , m_DigitalMedia2 ) . withImager ( new Camera ( 1 , "Camera1" , CameraTypeEnum . VISIBLE ) ) . withImageCaptureReason ( new ImageCaptureReason ( ImageCaptureReasonEnum . OTHER , "reason1" ) ) ; m_PersistedObservation = createBaseObservation ( ) ; m_PersistedObservation . setDigitalMedia ( m_DigitalMedia1 ) ; m_PersistedObservation . setImageMetadata ( imgMetaData1 ) ; m_ObservationStore . persist ( m_PersistedObservation ) ; ImageMetadata imgMetaData2 = new ImageMetadata ( ) . withCaptureTime ( 100L ) . withMaskSamplesOfInterest ( m_DigitalMedia1 , m_DigitalMedia2 ) . withImager ( new Camera ( 1 , "Camera1" , CameraTypeEnum . VISIBLE ) ) . withImageCaptureReason ( new ImageCaptureReason ( ImageCaptureReasonEnum . OTHER , "reason2" ) ) ; Observation observation = createBaseObservation ( ) ; observation . setDigitalMedia ( m_DigitalMedia1 ) ; observation . setImageMetadata ( imgMetaData2 ) ; m_ObservationStore . persist ( observation ) ; m_ObservationStore . remove ( observation ) ; observation = m_ObservationStore . find ( m_PersistedObservation . getUuid ( ) ) ; assertEquals ( m_PersistedObservation , observation ) ; }
Make sure that observations with duplicate media data can be persisted and deleted.
Make sure that observations with duplicate media data can be persisted and deleted .
// Persist the first observation // Persist second observation containing some duplicate data // Verify that all data exists for the first observation persisted