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));
}
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));
}
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));
}
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;
}
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));
}
Aggregations