Search in sources :

Example 71 with Cell

use of eu.esdihumboldt.hale.common.align.model.Cell 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());
}
Also used : ParameterValue(eu.esdihumboldt.hale.common.align.model.ParameterValue) Cell(eu.esdihumboldt.hale.common.align.model.Cell) Test(org.junit.Test)

Example 72 with Cell

use of eu.esdihumboldt.hale.common.align.model.Cell 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());
}
Also used : ParameterValue(eu.esdihumboldt.hale.common.align.model.ParameterValue) Cell(eu.esdihumboldt.hale.common.align.model.Cell) Test(org.junit.Test)

Example 73 with Cell

use of eu.esdihumboldt.hale.common.align.model.Cell 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());
}
Also used : ParameterValue(eu.esdihumboldt.hale.common.align.model.ParameterValue) Cell(eu.esdihumboldt.hale.common.align.model.Cell) Test(org.junit.Test)

Example 74 with Cell

use of eu.esdihumboldt.hale.common.align.model.Cell 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());
}
Also used : ParameterValue(eu.esdihumboldt.hale.common.align.model.ParameterValue) ArrayList(java.util.ArrayList) Cell(eu.esdihumboldt.hale.common.align.model.Cell) Test(org.junit.Test)

Example 75 with Cell

use of eu.esdihumboldt.hale.common.align.model.Cell in project hale by halestudio.

the class OMLReaderTest method testOrdinatesToPoint1.

/**
 * Test for ordinates to point function in alignment5
 */
@Test
public void testOrdinatesToPoint1() {
    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.geometric.ordinates_to_point")) {
            cell = temp;
            break;
        }
    }
    ListMultimap<String, ? extends Entity> src = cell.getSource();
    // the parameters were moved to the source entities with the appropriate
    // names so get the source entities with name "X"/"Y"
    Entity srcX = src.get("X").get(0);
    Entity srcY = src.get("Y").get(0);
    // check if the source entity has the correct value
    assertEquals("HOCHWERT", srcX.getDefinition().getDefinition().getDisplayName());
    assertEquals("RECHTSWERT", srcY.getDefinition().getDefinition().getDisplayName());
}
Also used : Entity(eu.esdihumboldt.hale.common.align.model.Entity) Cell(eu.esdihumboldt.hale.common.align.model.Cell) Test(org.junit.Test)

Aggregations

Cell (eu.esdihumboldt.hale.common.align.model.Cell)123 ArrayList (java.util.ArrayList)33 MutableCell (eu.esdihumboldt.hale.common.align.model.MutableCell)28 ParameterValue (eu.esdihumboldt.hale.common.align.model.ParameterValue)28 Test (org.junit.Test)27 Entity (eu.esdihumboldt.hale.common.align.model.Entity)24 DefaultCell (eu.esdihumboldt.hale.common.align.model.impl.DefaultCell)24 EntityDefinition (eu.esdihumboldt.hale.common.align.model.EntityDefinition)18 BaseAlignmentCell (eu.esdihumboldt.hale.common.align.model.BaseAlignmentCell)16 TypeEntityDefinition (eu.esdihumboldt.hale.common.align.model.impl.TypeEntityDefinition)16 AlignmentService (eu.esdihumboldt.hale.ui.service.align.AlignmentService)16 TypeDefinition (eu.esdihumboldt.hale.common.schema.model.TypeDefinition)15 Alignment (eu.esdihumboldt.hale.common.align.model.Alignment)13 HashSet (java.util.HashSet)13 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)12 Type (eu.esdihumboldt.hale.common.align.model.Type)11 List (java.util.List)11 ModifiableCell (eu.esdihumboldt.hale.common.align.model.ModifiableCell)9 PropertyEntityDefinition (eu.esdihumboldt.hale.common.align.model.impl.PropertyEntityDefinition)9 Property (eu.esdihumboldt.hale.common.align.model.Property)8