Search in sources :

Example 6 with SimpleDataRecordType

use of net.opengis.swe.x101.SimpleDataRecordType in project arctic-sea by 52North.

the class SweCommonEncoderv101Test method should_encode_simpleDatarecord_with_quantities.

@Test
public void should_encode_simpleDatarecord_with_quantities() throws EncodingException {
    final String name = "field-1";
    final String unit = "m";
    final Double value = 1.1;
    final String name2 = "field-2";
    final String unit2 = "urn:ogc:def:uom:UCUM::m";
    final Double value2 = 1.2;
    final XmlObject encode = sweCommonEncoderv101.encode(new SweSimpleDataRecord().addField(new SweField(name, new SweQuantity().setUom(unit).setValue(value))).addField(new SweField(name2, new SweQuantity().setUom(unit2).setValue(value2))));
    assertThat(encode, instanceOf(SimpleDataRecordType.class));
    final SimpleDataRecordType xbSimpleDataRecord = (SimpleDataRecordType) encode;
    assertThat(xbSimpleDataRecord.getFieldArray().length, is(2));
    final AnyScalarPropertyType field1 = xbSimpleDataRecord.getFieldArray(0);
    final AnyScalarPropertyType field2 = xbSimpleDataRecord.getFieldArray(1);
    // unit in code
    assertThat(field1.getName(), is(name));
    assertThat(field1.isSetQuantity(), is(TRUE));
    assertThat(field1.getQuantity().getValue(), is(value));
    assertThat(field1.getQuantity().getUom().getCode(), is(unit));
    // unit in href
    assertThat(field2.getName(), is(name2));
    assertThat(field2.isSetQuantity(), is(TRUE));
    assertThat(field2.getQuantity().getValue(), is(value2));
    assertThat(field2.getQuantity().getUom().getHref(), is(unit2));
}
Also used : SweQuantity(org.n52.shetland.ogc.swe.simpleType.SweQuantity) SweSimpleDataRecord(org.n52.shetland.ogc.swe.SweSimpleDataRecord) SweField(org.n52.shetland.ogc.swe.SweField) AnyScalarPropertyType(net.opengis.swe.x101.AnyScalarPropertyType) XmlObject(org.apache.xmlbeans.XmlObject) SimpleDataRecordType(net.opengis.swe.x101.SimpleDataRecordType) Test(org.junit.Test)

Example 7 with SimpleDataRecordType

use of net.opengis.swe.x101.SimpleDataRecordType in project arctic-sea by 52North.

the class SweCommonEncoderv101Test method should_encode_simpleDatarecord_with_fieldBoolean.

@Test
public void should_encode_simpleDatarecord_with_fieldBoolean() throws EncodingException {
    final String field1Name = "field-1";
    final Boolean field1Value = Boolean.TRUE;
    final XmlObject encode = sweCommonEncoderv101.encode(new SweSimpleDataRecord().addField(new SweField(field1Name, new SweBoolean().setValue(field1Value))));
    assertThat(encode, instanceOf(SimpleDataRecordType.class));
    final SimpleDataRecordType xbSimpleDataRecord = (SimpleDataRecordType) encode;
    final AnyScalarPropertyType field1 = xbSimpleDataRecord.getFieldArray(0);
    assertThat(xbSimpleDataRecord.getFieldArray().length, is(1));
    assertThat(field1.isSetBoolean(), is(TRUE));
    assertThat(field1.getName(), is(field1Name));
    assertThat(field1.getBoolean().getValue(), is(field1Value));
}
Also used : SweSimpleDataRecord(org.n52.shetland.ogc.swe.SweSimpleDataRecord) SweField(org.n52.shetland.ogc.swe.SweField) AnyScalarPropertyType(net.opengis.swe.x101.AnyScalarPropertyType) XmlObject(org.apache.xmlbeans.XmlObject) SweBoolean(org.n52.shetland.ogc.swe.simpleType.SweBoolean) SweBoolean(org.n52.shetland.ogc.swe.simpleType.SweBoolean) SimpleDataRecordType(net.opengis.swe.x101.SimpleDataRecordType) Test(org.junit.Test)

Example 8 with SimpleDataRecordType

use of net.opengis.swe.x101.SimpleDataRecordType in project arctic-sea by 52North.

the class SweCommonEncoderv101Test method should_encode_simpleDatarecord_with_fieldCategory.

@Test
public void should_encode_simpleDatarecord_with_fieldCategory() throws EncodingException {
    final String name = "field-1";
    final String value = "field-1-value";
    final String codeSpace = "field-1-codespace";
    final XmlObject encode = sweCommonEncoderv101.encode(new SweSimpleDataRecord().addField(new SweField(name, new SweCategory().setValue(value).setCodeSpace(codeSpace))));
    assertThat(encode, instanceOf(SimpleDataRecordType.class));
    final SimpleDataRecordType xbSimpleDataRecord = (SimpleDataRecordType) encode;
    final AnyScalarPropertyType field1 = xbSimpleDataRecord.getFieldArray(0);
    assertThat(xbSimpleDataRecord.getFieldArray().length, is(1));
    assertThat(field1.isSetCategory(), is(TRUE));
    assertThat(field1.getName(), is(name));
    assertThat(field1.getCategory().getValue(), is(value));
    assertThat(field1.getCategory().isSetCodeSpace(), is(TRUE));
    assertThat(field1.getCategory().getCodeSpace().isSetHref(), is(TRUE));
}
Also used : SweSimpleDataRecord(org.n52.shetland.ogc.swe.SweSimpleDataRecord) SweField(org.n52.shetland.ogc.swe.SweField) AnyScalarPropertyType(net.opengis.swe.x101.AnyScalarPropertyType) SweCategory(org.n52.shetland.ogc.swe.simpleType.SweCategory) XmlObject(org.apache.xmlbeans.XmlObject) SimpleDataRecordType(net.opengis.swe.x101.SimpleDataRecordType) Test(org.junit.Test)

Example 9 with SimpleDataRecordType

use of net.opengis.swe.x101.SimpleDataRecordType in project arctic-sea by 52North.

the class SweCommonEncoderv101Test method should_encode_simpleDatarecord_with_fieldTime.

@Test
public void should_encode_simpleDatarecord_with_fieldTime() throws EncodingException {
    final String name = "field-1";
    final DateTime value = new DateTime(DateTimeZone.UTC);
    final XmlObject encode = sweCommonEncoderv101.encode(new SweSimpleDataRecord().addField(new SweField(name, new SweTime().setValue(value))));
    assertThat(encode, instanceOf(SimpleDataRecordType.class));
    final SimpleDataRecordType xbSimpleDataRecord = (SimpleDataRecordType) encode;
    final AnyScalarPropertyType field1 = xbSimpleDataRecord.getFieldArray(0);
    assertThat(xbSimpleDataRecord.getFieldArray().length, is(1));
    assertThat(field1.getName(), is(name));
    assertThat(field1.isSetTime(), is(TRUE));
    assertThat(DateTimeHelper.parseIsoString2DateTime(field1.getTime().getValue().toString()).toString(), is(value.toString()));
}
Also used : SweTime(org.n52.shetland.ogc.swe.simpleType.SweTime) SweSimpleDataRecord(org.n52.shetland.ogc.swe.SweSimpleDataRecord) SweField(org.n52.shetland.ogc.swe.SweField) AnyScalarPropertyType(net.opengis.swe.x101.AnyScalarPropertyType) XmlObject(org.apache.xmlbeans.XmlObject) DateTime(org.joda.time.DateTime) SimpleDataRecordType(net.opengis.swe.x101.SimpleDataRecordType) Test(org.junit.Test)

Example 10 with SimpleDataRecordType

use of net.opengis.swe.x101.SimpleDataRecordType in project arctic-sea by 52North.

the class SweCommonEncoderv101Test method should_encode_simpleDatarecord_with_fieldQuantity.

@Test
public void should_encode_simpleDatarecord_with_fieldQuantity() throws EncodingException {
    final String name = "field-1";
    final double value = 42.5;
    final XmlObject encode = sweCommonEncoderv101.encode(new SweSimpleDataRecord().addField(new SweField(name, new SweQuantity().setValue(value))));
    assertThat(encode, instanceOf(SimpleDataRecordType.class));
    final SimpleDataRecordType xbSimpleDataRecord = (SimpleDataRecordType) encode;
    final AnyScalarPropertyType field1 = xbSimpleDataRecord.getFieldArray(0);
    assertThat(xbSimpleDataRecord.getFieldArray().length, is(1));
    assertThat(field1.getName(), is(name));
    assertThat(field1.isSetQuantity(), is(TRUE));
    assertThat(field1.getQuantity().getValue(), is(value));
}
Also used : SweQuantity(org.n52.shetland.ogc.swe.simpleType.SweQuantity) SweSimpleDataRecord(org.n52.shetland.ogc.swe.SweSimpleDataRecord) SweField(org.n52.shetland.ogc.swe.SweField) AnyScalarPropertyType(net.opengis.swe.x101.AnyScalarPropertyType) XmlObject(org.apache.xmlbeans.XmlObject) SimpleDataRecordType(net.opengis.swe.x101.SimpleDataRecordType) Test(org.junit.Test)

Aggregations

SimpleDataRecordType (net.opengis.swe.x101.SimpleDataRecordType)14 AnyScalarPropertyType (net.opengis.swe.x101.AnyScalarPropertyType)11 Test (org.junit.Test)11 SweField (org.n52.shetland.ogc.swe.SweField)10 SweSimpleDataRecord (org.n52.shetland.ogc.swe.SweSimpleDataRecord)9 XmlObject (org.apache.xmlbeans.XmlObject)8 Capabilities (net.opengis.sensorML.x101.CapabilitiesDocument.Capabilities)4 SensorMLDocument (net.opengis.sensorML.x101.SensorMLDocument)3 SystemType (net.opengis.sensorML.x101.SystemType)3 AbstractProcess (org.n52.shetland.ogc.sensorML.AbstractProcess)3 SweBoolean (org.n52.shetland.ogc.swe.simpleType.SweBoolean)2 SweQuantity (org.n52.shetland.ogc.swe.simpleType.SweQuantity)2 SweText (org.n52.shetland.ogc.swe.simpleType.SweText)2 StringOrRefType (net.opengis.gml.StringOrRefType)1 Characteristics (net.opengis.sensorML.x101.CharacteristicsDocument.Characteristics)1 DateTime (org.joda.time.DateTime)1 SmlCharacteristics (org.n52.shetland.ogc.sensorML.elements.SmlCharacteristics)1 SweDataRecord (org.n52.shetland.ogc.swe.SweDataRecord)1 SweCategory (org.n52.shetland.ogc.swe.simpleType.SweCategory)1 SweCount (org.n52.shetland.ogc.swe.simpleType.SweCount)1