use of org.n52.shetland.ogc.swe.simpleType.SweBoolean in project arctic-sea by 52North.
the class HasExtension method addSweBooleanExtension.
default void addSweBooleanExtension(String name, boolean value) {
SweBoolean sweBoolean = new SweBoolean();
sweBoolean.setValue(value);
sweBoolean.setIdentifier(name);
addSwesExtension(name, sweBoolean);
}
use of org.n52.shetland.ogc.swe.simpleType.SweBoolean in project arctic-sea by 52North.
the class SmlIoTest method should_return_true_if_ioValue_is_set.
@Test
public void should_return_true_if_ioValue_is_set() {
final SweBoolean ioValue = new SweBoolean();
final SmlIo smlIo = new SmlIo(ioValue);
assertThat(smlIo.isSetValue(), is(TRUE));
}
use of org.n52.shetland.ogc.swe.simpleType.SweBoolean in project arctic-sea by 52North.
the class SweDataRecordTest method getFieldIndexByIdentifier_should_not_fail_on_bad_input.
@Test
public void getFieldIndexByIdentifier_should_not_fail_on_bad_input() {
final SweDataRecord dataRecord = new SweDataRecord();
dataRecord.addField(new SweField("identifier", new SweBoolean()));
final SweBoolean b = new SweBoolean();
b.setDefinition("test-element-definition");
dataRecord.addField(new SweField("test-field-name", b));
assertThat(dataRecord.getFieldIndexByIdentifier(null), is(-1));
assertThat(dataRecord.getFieldIndexByIdentifier(""), is(-1));
}
use of org.n52.shetland.ogc.swe.simpleType.SweBoolean in project arctic-sea by 52North.
the class FieldDecoderTest method testBooleanWithValueTrue.
@Test
public void testBooleanWithValueTrue() throws DecodingException {
ObjectNode json = createField().put(JSONConstants.TYPE, JSONConstants.BOOLEAN_TYPE).put(JSONConstants.VALUE, true);
SweField field = checkCommon(json, true);
assertThat(field.getElement(), is(instanceOf(SweBoolean.class)));
SweBoolean swe = (SweBoolean) field.getElement();
errors.checkThat(swe.getValue(), is(true));
}
use of org.n52.shetland.ogc.swe.simpleType.SweBoolean in project arctic-sea by 52North.
the class FieldEncoder method encodeSweBooleanField.
private ObjectNode encodeSweBooleanField(SweField field) {
ObjectNode jfield = createField(field);
jfield.put(JSONConstants.TYPE, JSONConstants.BOOLEAN_TYPE);
SweBoolean sweBoolean = (SweBoolean) field.getElement();
if (sweBoolean.isSetValue()) {
jfield.put(JSONConstants.VALUE, sweBoolean.getValue());
}
return jfield;
}
Aggregations