Search in sources :

Example 1 with SmlClassifier

use of org.n52.shetland.ogc.sensorML.elements.SmlClassifier in project arctic-sea by 52North.

the class SmlClassifierTest method shouldReturnTrueIfCodeSpaceIsSetAndNotEmpty.

@Test
public void shouldReturnTrueIfCodeSpaceIsSetAndNotEmpty() {
    final String codeSpace = "test-codespace";
    final SmlClassifier smlClassifier = new SmlClassifier("name", "definition", codeSpace, "value");
    assertThat(smlClassifier.isSetCodeSpace(), is(true));
    assertThat(smlClassifier.getCodeSpace(), is(codeSpace));
}
Also used : SmlClassifier(org.n52.shetland.ogc.sensorML.elements.SmlClassifier) Test(org.junit.Test)

Example 2 with SmlClassifier

use of org.n52.shetland.ogc.sensorML.elements.SmlClassifier in project arctic-sea by 52North.

the class SmlClassifierTest method shouldReturnFalseIfDefinitionIsEmptyOrNotSet.

@Test
public void shouldReturnFalseIfDefinitionIsEmptyOrNotSet() {
    final String definition = null;
    final SmlClassifier smlClassifier = new SmlClassifier("name", definition, "codeSpace", "value");
    assertThat(smlClassifier.isSetDefinition(), is(false));
    smlClassifier.setDefinition("");
    assertThat(smlClassifier.isSetDefinition(), is(false));
}
Also used : SmlClassifier(org.n52.shetland.ogc.sensorML.elements.SmlClassifier) Test(org.junit.Test)

Example 3 with SmlClassifier

use of org.n52.shetland.ogc.sensorML.elements.SmlClassifier in project arctic-sea by 52North.

the class SmlClassifierTest method shouldReturnTrueIfDefinitionIsSetAndNotEmpty.

@Test
public void shouldReturnTrueIfDefinitionIsSetAndNotEmpty() {
    final String definition = "test-definition";
    final SmlClassifier smlClassifier = new SmlClassifier(null, definition, null, null);
    assertThat(smlClassifier.isSetDefinition(), is(true));
    assertThat(smlClassifier.getDefinition(), is(definition));
}
Also used : SmlClassifier(org.n52.shetland.ogc.sensorML.elements.SmlClassifier) Test(org.junit.Test)

Example 4 with SmlClassifier

use of org.n52.shetland.ogc.sensorML.elements.SmlClassifier in project arctic-sea by 52North.

the class SensorMLDecoderV20 method parseClassification.

/**
 * Parses the classification
 *
 * @param clpts
 *            XML classification
 * @return SOS classification
 */
private List<SmlClassifier> parseClassification(final ClassifierListPropertyType[] clpts) {
    final List<SmlClassifier> sosClassifiers = new ArrayList<>(clpts.length);
    for (final ClassifierListPropertyType clpt : clpts) {
        if (clpt.isSetClassifierList()) {
            ClassifierListType clt = clpt.getClassifierList();
            if (CollectionHelper.isNotNullOrEmpty(clt.getClassifierArray())) {
                for (final Classifier c : clt.getClassifierArray()) {
                    if (c.getTerm() != null) {
                        final SmlClassifier smlClassifier = new SmlClassifier();
                        parseTerm(c.getTerm(), smlClassifier);
                        sosClassifiers.add(smlClassifier);
                    }
                }
            }
        }
    }
    return sosClassifiers;
}
Also used : SmlClassifier(org.n52.shetland.ogc.sensorML.elements.SmlClassifier) ArrayList(java.util.ArrayList) SmlClassifier(org.n52.shetland.ogc.sensorML.elements.SmlClassifier) Classifier(net.opengis.sensorml.x20.ClassifierListType.Classifier) ClassifierListType(net.opengis.sensorml.x20.ClassifierListType) ClassifierListPropertyType(net.opengis.sensorml.x20.ClassifierListPropertyType)

Example 5 with SmlClassifier

use of org.n52.shetland.ogc.sensorML.elements.SmlClassifier in project arctic-sea by 52North.

the class SmlClassifierTest method shouldReturnFalseIfCodeSpaceIsEmptyOrNotSet.

@Test
public void shouldReturnFalseIfCodeSpaceIsEmptyOrNotSet() {
    final String codeSpace = null;
    final SmlClassifier smlClassifier = new SmlClassifier("name", "definition", codeSpace, "value");
    assertThat(smlClassifier.isSetCodeSpace(), is(false));
    smlClassifier.setCodeSpace("");
    assertThat(smlClassifier.isSetCodeSpace(), is(false));
}
Also used : SmlClassifier(org.n52.shetland.ogc.sensorML.elements.SmlClassifier) Test(org.junit.Test)

Aggregations

SmlClassifier (org.n52.shetland.ogc.sensorML.elements.SmlClassifier)6 Test (org.junit.Test)4 ArrayList (java.util.ArrayList)1 Classification (net.opengis.sensorML.x101.ClassificationDocument.Classification)1 ClassifierList (net.opengis.sensorML.x101.ClassificationDocument.Classification.ClassifierList)1 Classifier (net.opengis.sensorML.x101.ClassificationDocument.Classification.ClassifierList.Classifier)1 Term (net.opengis.sensorML.x101.TermDocument.Term)1 ClassifierListPropertyType (net.opengis.sensorml.x20.ClassifierListPropertyType)1 ClassifierListType (net.opengis.sensorml.x20.ClassifierListType)1 Classifier (net.opengis.sensorml.x20.ClassifierListType.Classifier)1