mil.dod.th.ose.core.integration/src/mil/dod/th/ose/core/integration/TestObservation.java
public void testObsDupDetection() throws PersistenceFailedException, ValidationFailedException
    {
        Detection detection = new Detection().withType(DetectionTypeEnum.TEST)
            .withTargetLocation(SpatialTypesFactory.newCoordinates(5, 44))
            .withTargetOrientation(SpatialTypesFactory.newOrientation(180.0, -80.0, 45.0))
            .withTargetFrequency(new FrequencyKhz().withValue(30))
            .withTargetId("example-target-id");

        // Persist the first observation
        m_PersistedObservation = createBaseObservation();
        m_PersistedObservation.setDetection(detection);
        m_ObservationStore.persist(m_PersistedObservation);

        // Persist second observation containing some duplicate data
        Observation observation = createBaseObservation();
        observation.setDetection(detection);

        try
        {
            m_ObservationStore.persist(observation);
            fail("Persistence failed exception expected.");
        }
        catch (PersistenceFailedException e)
        {
            // Expected
        }
    }
/**
     * Make sure that observations with duplicate sub-type data cannot be persisted.
     */
Make sure that observations with duplicate sub-type data cannot be persisted.
Make sure that observations with duplicate sub - type data cannot be persisted .
public void testObsDupDetection() throws PersistenceFailedException, ValidationFailedException
    {
        Detection detection = new Detection().withType(DetectionTypeEnum.TEST)
            .withTargetLocation(SpatialTypesFactory.newCoordinates(5, 44))
            .withTargetOrientation(SpatialTypesFactory.newOrientation(180.0, -80.0, 45.0))
            .withTargetFrequency(new FrequencyKhz().withValue(30))
            .withTargetId("example-target-id");
        m_PersistedObservation = createBaseObservation();
        m_PersistedObservation.setDetection(detection);
        m_ObservationStore.persist(m_PersistedObservation);
        Observation observation = createBaseObservation();
        observation.setDetection(detection);
        try
        {
            m_ObservationStore.persist(observation);
            fail("Persistence failed exception expected.");
        }
        catch (PersistenceFailedException e)
        {
        }
    }
public void testObsDupDetection ( ) throws PersistenceFailedException , ValidationFailedException { Detection detection = new Detection ( ) . withType ( DetectionTypeEnum . TEST ) . withTargetLocation ( SpatialTypesFactory . newCoordinates ( 5 , 44 ) ) . withTargetOrientation ( SpatialTypesFactory . newOrientation ( 180.0 , - 80.0 , 45.0 ) ) . withTargetFrequency ( new FrequencyKhz ( ) . withValue ( 30 ) ) . withTargetId ( "example-target-id" ) ; m_PersistedObservation = createBaseObservation ( ) ; m_PersistedObservation . setDetection ( detection ) ; m_ObservationStore . persist ( m_PersistedObservation ) ; Observation observation = createBaseObservation ( ) ; observation . setDetection ( detection ) ; try { m_ObservationStore . persist ( observation ) ; fail ( "Persistence failed exception expected." ) ; } catch ( PersistenceFailedException e ) { } }
Make sure that observations with duplicate sub-type data cannot be persisted.
Make sure that observations with duplicate sub - type data cannot be persisted .
// Persist the first observation // Persist second observation containing some duplicate data // Expected