use of eu.esdihumboldt.hale.common.align.model.ParameterValue in project hale by halestudio.
the class OMLReaderTest method testClassificationMapping1.
/**
* Test for classification mapping function in alignment2
*/
@Test
public void testClassificationMapping1() {
Collection<? extends Cell> cells = alignment2.getCells();
Iterator<? extends Cell> it = cells.iterator();
Cell cell = null;
while (it.hasNext()) {
Cell temp = it.next();
if (temp.getTransformationIdentifier().equals("eu.esdihumboldt.hale.align.classification")) {
cell = temp;
break;
}
}
ListMultimap<String, ParameterValue> params = cell.getTransformationParameters();
List<ParameterValue> values = params.get("classificationMapping");
for (int i = 0; i < values.size(); i++) {
String temp = values.get(i).as(String.class);
if (i == 0) {
assertEquals("onGroundSurface 3", temp);
}
if (i == 1) {
assertEquals("suspendedOrElevated 2", temp);
}
if (i == 2) {
assertEquals("underground 1", temp);
}
}
// check if all values were tested
assertEquals(3, values.size());
}
use of eu.esdihumboldt.hale.common.align.model.ParameterValue in project hale by halestudio.
the class OMLReaderTest method testIdentifier.
/**
* test for the inspire identifier function in alignment5
*/
@Test
public void testIdentifier() {
Collection<? extends Cell> cells = alignment5.getCells();
Iterator<? extends Cell> it = cells.iterator();
Cell cell = null;
while (it.hasNext()) {
Cell temp = it.next();
if (temp.getTransformationIdentifier().equals("eu.esdihumboldt.cst.functions.inspire.identifier")) {
cell = temp;
break;
}
}
ListMultimap<String, ParameterValue> params = cell.getTransformationParameters();
List<ParameterValue> country = params.get("countryName");
List<ParameterValue> provider = params.get("providerName");
List<ParameterValue> product = params.get("productName");
List<ParameterValue> version = params.get("version");
List<ParameterValue> versionNilReason = params.get("versionNilReason");
// check if all parameters were set once
assertEquals(1, country.size());
assertEquals(1, provider.size());
assertEquals(1, product.size());
assertEquals(1, version.size());
assertEquals(1, versionNilReason.size());
// now test if they have correct values
assertEquals("at", country.get(0).getValue());
assertEquals("BEV", provider.get(0).getValue());
assertEquals("humboldt-sample-transformed-data-CadastralParcels", product.get(0).getValue());
assertEquals("", version.get(0).getValue());
assertEquals("unknown", versionNilReason.get(0).getValue());
// check if all parameters were tested
assertEquals(5, params.size());
}
use of eu.esdihumboldt.hale.common.align.model.ParameterValue in project hale by halestudio.
the class OMLReaderTest method testFormattedString2.
/**
* Extended test for formatted string function in alignment3
*/
@Test
public void testFormattedString2() {
Collection<? extends Cell> cells = alignment3.getCells();
Iterator<? extends Cell> it = cells.iterator();
Cell cell = null;
while (it.hasNext()) {
Cell temp = it.next();
if (temp.getTransformationIdentifier().equals("eu.esdihumboldt.hale.align.formattedstring")) {
cell = temp;
break;
}
}
assertNotNull(cell);
ListMultimap<String, ParameterValue> params = cell.getTransformationParameters();
List<ParameterValue> values = params.get("pattern");
assertEquals(1, values.size());
// size is 1
assertEquals("{flurstuecksnummer.AX_Flurstuecksnummer.zaehler}/{flurstuecksnummer.AX_Flurstuecksnummer.nenner}", values.get(0).getValue());
}
use of eu.esdihumboldt.hale.common.align.model.ParameterValue in project hale by halestudio.
the class OMLReaderTest method testFormattedString1.
/**
* Test for formatted string translation in aligment
*/
@Test
public void testFormattedString1() {
Collection<? extends Cell> cells = alignment.getCells();
Iterator<? extends Cell> it = cells.iterator();
Cell cell = null;
while (it.hasNext()) {
Cell temp = it.next();
if (temp.getTransformationIdentifier().equals("eu.esdihumboldt.hale.align.formattedstring")) {
cell = temp;
break;
}
}
ListMultimap<String, ParameterValue> params = cell.getTransformationParameters();
List<ParameterValue> values = params.get("pattern");
assertEquals(1, values.size());
// size is 1, so "get(0)" works fine
assertEquals("{id}-xxx-{details.address.street}", values.get(0).getValue());
}
use of eu.esdihumboldt.hale.common.align.model.ParameterValue in project hale by halestudio.
the class OMLReaderTest method testNetworkExpansion2.
/**
* Test for network expansion function in alignment5
*/
@Test
public void testNetworkExpansion2() {
Collection<? extends Cell> cells = alignment5.getCells();
Iterator<? extends Cell> it = cells.iterator();
List<Cell> networkCells = new ArrayList<Cell>();
while (it.hasNext()) {
Cell temp = it.next();
if (temp.getTransformationIdentifier().equals("eu.esdihumboldt.cst.functions.geometric.networkexpansion")) {
networkCells.add(temp);
}
}
for (int i = 0; i < networkCells.size(); i++) {
Cell cell = networkCells.get(i);
ListMultimap<String, ParameterValue> params = cell.getTransformationParameters();
List<ParameterValue> values = params.get("bufferWidth");
String temp = values.get(0).as(String.class);
if (i == 0) {
assertEquals("50", temp);
}
if (i == 1) {
assertEquals("5", temp);
}
}
// check if all cells were tested
assertEquals(2, networkCells.size());
}
Aggregations