use of org.n52.shetland.ogc.sensorML.AbstractProcess in project arctic-sea by 52North.
the class SensorMLDecoderV101Test method should_decode_parent_procedures_from_sml.
@Test
public void should_decode_parent_procedures_from_sml() throws DecodingException {
SensorMLDocument xbSmlDoc = getSensorMLDoc();
SystemType xbSystem = (SystemType) xbSmlDoc.getSensorML().addNewMember().addNewProcess().substitute(SensorMLConstants.SYSTEM_QNAME, SystemType.type);
Capabilities xbCapabilities = xbSystem.addNewCapabilities();
xbCapabilities.setName(SensorMLConstants.ELEMENT_NAME_PARENT_PROCEDURES);
SimpleDataRecordType xbSimpleDataRecord = (SimpleDataRecordType) xbCapabilities.addNewAbstractDataRecord().substitute(SweConstants.QN_SIMPLEDATARECORD_SWE_101, SimpleDataRecordType.type);
addCapabilitiesInsertionMetadata(xbSimpleDataRecord, TEST_ID_1, TEST_NAME_1);
addCapabilitiesInsertionMetadata(xbSimpleDataRecord, TEST_ID_2, TEST_NAME_2);
AbstractProcess absProcess = decodeAbstractProcess(xbSmlDoc);
// assertThat(absProcess.getParentProcedures().size(), is(2));
assertThat(absProcess.getCapabilities().size(), is(1));
// List<String> parentProcedures = new ArrayList<String>(absProcess.getParentProcedures());
// Collections.sort(parentProcedures);
// assertThat(parentProcedures.get(0), is(TEST_ID_1));
// assertThat(parentProcedures.get(1), is(TEST_ID_2));
}
use of org.n52.shetland.ogc.sensorML.AbstractProcess in project arctic-sea by 52North.
the class SensorMLDecoderV101Test method should_decode_offerings_from_sml.
@Test
public void should_decode_offerings_from_sml() throws DecodingException {
SensorMLDocument xbSmlDoc = getSensorMLDoc();
SystemType xbSystem = (SystemType) xbSmlDoc.getSensorML().addNewMember().addNewProcess().substitute(SensorMLConstants.SYSTEM_QNAME, SystemType.type);
Capabilities xbCapabilities = xbSystem.addNewCapabilities();
xbCapabilities.setName(SensorMLConstants.ELEMENT_NAME_OFFERINGS);
SimpleDataRecordType xbSimpleDataRecord = (SimpleDataRecordType) xbCapabilities.addNewAbstractDataRecord().substitute(SweConstants.QN_SIMPLEDATARECORD_SWE_101, SimpleDataRecordType.type);
addCapabilitiesInsertionMetadata(xbSimpleDataRecord, TEST_ID_1, TEST_NAME_1);
addCapabilitiesInsertionMetadata(xbSimpleDataRecord, TEST_ID_2, TEST_NAME_2);
AbstractProcess absProcess = decodeAbstractProcess(xbSmlDoc);
// assertThat(absProcess.getOfferings().size(), is(2));
assertThat(absProcess.getCapabilities().size(), is(1));
// List<SosOffering> sosOfferings = new ArrayList<SosOffering>(absProcess.getOfferings());
// Collections.sort(sosOfferings);
// assertThat(sosOfferings.get(0).getIdentifier(), is(TEST_ID_1));
// assertThat(sosOfferings.get(0).getOfferingName(), is(TEST_NAME_1));
// assertThat(sosOfferings.get(1).getIdentifier(), is(TEST_ID_2));
// assertThat(sosOfferings.get(1).getOfferingName(), is(TEST_NAME_2));
}
use of org.n52.shetland.ogc.sensorML.AbstractProcess in project arctic-sea by 52North.
the class SensorMLDecoderV101Test method should_set_identifier_by_identifier_name.
@Test
public void should_set_identifier_by_identifier_name() throws DecodingException {
SensorMLDocument xbSmlDoc = getSensorMLDoc();
SystemType xbSystem = (SystemType) xbSmlDoc.getSensorML().addNewMember().addNewProcess().substitute(SensorMLConstants.SYSTEM_QNAME, SystemType.type);
IdentifierList xbIdentifierList = xbSystem.addNewIdentification().addNewIdentifierList();
addIdentifier(xbIdentifierList, OGCConstants.URN_UNIQUE_IDENTIFIER_END, null, TEST_ID_1);
addIdentifier(xbIdentifierList, "any name", null, TEST_ID_2);
AbstractProcess absProcess = decodeAbstractProcess(xbSmlDoc);
assertThat(absProcess.getIdentifier(), is(TEST_ID_1));
assertThat(absProcess.getIdentifications().size(), is(2));
}
use of org.n52.shetland.ogc.sensorML.AbstractProcess in project arctic-sea by 52North.
the class SensorMLDecoderV101Test method should_decode_child_procedure_from_sml.
@Test
public void should_decode_child_procedure_from_sml() throws DecodingException {
SensorMLDocument xbSmlDoc = getSensorMLDoc();
SystemType xbSystem = (SystemType) xbSmlDoc.getSensorML().addNewMember().addNewProcess().substitute(SensorMLConstants.SYSTEM_QNAME, SystemType.type);
IdentifierList xbIdentifierList = xbSystem.addNewIdentification().addNewIdentifierList();
addIdentifier(xbIdentifierList, "anyname", OGCConstants.URN_UNIQUE_IDENTIFIER, TEST_ID_1);
ComponentList xbComponentList = xbSystem.addNewComponents().addNewComponentList();
addChildProcedure(xbComponentList, TEST_ID_2);
AbstractProcess absProcess = decodeAbstractProcess(xbSmlDoc);
assertThat(absProcess.getIdentifier(), is(TEST_ID_1));
// assertThat(absProcess.getChildProcedures().size(), is(1));
// SosProcedureDescription childProcedure = absProcess.getChildProcedures().iterator().next();
// assertThat(childProcedure, instanceOf(System.class));
// assertThat(childProcedure.getIdentifier(), is(TEST_ID_2));
}
use of org.n52.shetland.ogc.sensorML.AbstractProcess in project arctic-sea by 52North.
the class SensorMLDecoderV101Test method should_decode_io_from_sml.
@Test
public void should_decode_io_from_sml() throws DecodingException {
SensorMLDocument xbSmlDoc = getSensorMLDoc();
SystemType xbSystem = (SystemType) xbSmlDoc.getSensorML().addNewMember().addNewProcess().substitute(SensorMLConstants.SYSTEM_QNAME, SystemType.type);
InputList xbInputList = xbSystem.addNewInputs().addNewInputList();
OutputList xbOutputList = xbSystem.addNewOutputs().addNewOutputList();
IoComponentPropertyType input1 = xbInputList.addNewInput();
input1.setName("input1");
input1.addNewBoolean();
IoComponentPropertyType input2 = xbInputList.addNewInput();
input2.setName("input2");
input2.addNewCount();
IoComponentPropertyType output1 = xbOutputList.addNewOutput();
output1.setName("output1");
output1.addNewQuantity();
IoComponentPropertyType output2 = xbOutputList.addNewOutput();
output2.setName("output2");
DataArrayType dataArray = getDataArray();
output2.setAbstractDataArray1(dataArray);
XmlHelper.substituteElement(output2.getAbstractDataArray1(), dataArray);
IoComponentPropertyType output3 = xbOutputList.addNewOutput();
output3.setName("output3");
DataRecordType dataRecord = DataRecordType.Factory.newInstance();
output3.setAbstractDataRecord(dataRecord);
XmlHelper.substituteElement(output3.getAbstractDataRecord(), dataRecord);
AbstractProcess absProcess = decodeAbstractProcess(xbSmlDoc);
assertThat(absProcess.getInputs().get(0).getIoValue().getDataComponentType(), is(SweDataComponentType.Boolean));
// assertThat(
// ((SweAbstractSimpleType)absProcess.getInputs().get(0).getIoValue()).getDataComponentType(),
// is (SweDataComponentType.Boolean));
assertThat(absProcess.getInputs().get(1).getIoValue().getDataComponentType(), is(SweDataComponentType.Count));
// assertThat(
// ((SweAbstractSimpleType)absProcess.getInputs().get(1).getIoValue()).getDataComponentType(),
// is (SweDataComponentType.Count));
assertThat(absProcess.getOutputs().get(0).getIoValue().getDataComponentType(), is(SweDataComponentType.Quantity));
// assertThat(
// ((SweAbstractSimpleType)absProcess.getOutputs().get(0).getIoValue()).getDataComponentType(),
// is (SweDataComponentType.Quantity));
assertThat(absProcess.getOutputs().get(1).getIoValue().getDataComponentType(), is(SweDataComponentType.DataArray));
assertThat(absProcess.getOutputs().get(2).getIoValue().getDataComponentType(), is(SweDataComponentType.DataRecord));
}
Aggregations