Search in sources :

Example 1 with DefaultAcquisitionInformation

use of org.apache.sis.metadata.iso.acquisition.DefaultAcquisitionInformation in project sis by apache.

the class MetadataStandardTest method testEqualsOnCyclicMetadata.

/**
 * Tests the {@link MetadataStandard#equals(Object, Object, ComparisonMode)} method on an object
 * having cyclic associations. In absence of safety guard against infinite recursivity, this test
 * would produce {@link StackOverflowError}.
 */
@Test
@DependsOnMethod("testEquals")
public void testEqualsOnCyclicMetadata() {
    final DefaultAcquisitionInformation p1 = createCyclicMetadata();
    final DefaultAcquisitionInformation p2 = createCyclicMetadata();
    assertTrue("equals", p1.equals(p2));
    final DefaultPlatform platform = (DefaultPlatform) getSingleton(p2.getPlatforms());
    final DefaultInstrument instrument = (DefaultInstrument) getSingleton(platform.getInstruments());
    instrument.setType(new SimpleInternationalString("An other instrument type."));
    assertFalse("equals", p1.equals(p2));
}
Also used : DefaultAcquisitionInformation(org.apache.sis.metadata.iso.acquisition.DefaultAcquisitionInformation) SimpleInternationalString(org.apache.sis.util.iso.SimpleInternationalString) DefaultPlatform(org.apache.sis.metadata.iso.acquisition.DefaultPlatform) DefaultInstrument(org.apache.sis.metadata.iso.acquisition.DefaultInstrument) Test(org.junit.Test) DependsOnMethod(org.apache.sis.test.DependsOnMethod)

Example 2 with DefaultAcquisitionInformation

use of org.apache.sis.metadata.iso.acquisition.DefaultAcquisitionInformation in project sis by apache.

the class MetadataStandardTest method createCyclicMetadata.

/**
 * Creates a metadata object having a cyclic association. The cycle is between
 * {@code platform.instrument} and {@code instrument.isMountedOn}.
 */
static DefaultAcquisitionInformation createCyclicMetadata() {
    final DefaultInstrument instrument = new DefaultInstrument();
    instrument.setType(new SimpleInternationalString("An instrument type."));
    final DefaultPlatform platform = new DefaultPlatform();
    platform.setDescription(new SimpleInternationalString("A platform."));
    instrument.setMountedOn(platform);
    platform.setInstruments(singleton(instrument));
    final DefaultAcquisitionInformation acquisition = new DefaultAcquisitionInformation();
    acquisition.setPlatforms(singleton(platform));
    return acquisition;
}
Also used : SimpleInternationalString(org.apache.sis.util.iso.SimpleInternationalString) DefaultAcquisitionInformation(org.apache.sis.metadata.iso.acquisition.DefaultAcquisitionInformation) DefaultPlatform(org.apache.sis.metadata.iso.acquisition.DefaultPlatform) DefaultInstrument(org.apache.sis.metadata.iso.acquisition.DefaultInstrument)

Aggregations

DefaultAcquisitionInformation (org.apache.sis.metadata.iso.acquisition.DefaultAcquisitionInformation)2 DefaultInstrument (org.apache.sis.metadata.iso.acquisition.DefaultInstrument)2 DefaultPlatform (org.apache.sis.metadata.iso.acquisition.DefaultPlatform)2 SimpleInternationalString (org.apache.sis.util.iso.SimpleInternationalString)2 DependsOnMethod (org.apache.sis.test.DependsOnMethod)1 Test (org.junit.Test)1