From a5b00b8bf82178e33cf3f108ca2112c6548d82a8 Mon Sep 17 00:00:00 2001 From: felmer <felmer> Date: Wed, 18 Aug 2010 14:50:54 +0000 Subject: [PATCH] LMS-1707 tests fixed, name -> label SVN: 17516 --- .../CsvToCanonicalFeatureVector.java | 3 ++- .../GenedataFormatToCanonicalFeatureVector.java | 3 ++- .../dss/generic/server/FeatureTableBuilder.java | 12 ++++++------ .../screening/server/DssServiceRpcScreening.java | 2 +- .../imaging/dataaccess/ImgFeatureDefDTO.java | 16 ++++++++-------- .../CsvToCanonicalFeatureVectorTest.java | 4 ++-- .../featurevector/FeatureVectorUploaderTest.java | 2 +- .../genedata/FeatureStorageProcessorTest.java | 2 ++ ...nedataFormatToCanonicalFeatureVectorTest.java | 2 +- .../imaging/dataaccess/FeatureVectorDAOTest.java | 2 +- 10 files changed, 26 insertions(+), 22 deletions(-) diff --git a/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/featurevector/CsvToCanonicalFeatureVector.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/featurevector/CsvToCanonicalFeatureVector.java index ae694fa3221..692c1634205 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/featurevector/CsvToCanonicalFeatureVector.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/featurevector/CsvToCanonicalFeatureVector.java @@ -134,7 +134,8 @@ public class CsvToCanonicalFeatureVector CanonicalFeatureVector featureVector = new CanonicalFeatureVector(); CodeAndTitle codeAndTitle = new CodeAndTitle(column.name); ImgFeatureDefDTO featureDef = new ImgFeatureDefDTO(); - featureDef.setName(codeAndTitle.getTitle()); + featureDef.setLabel(codeAndTitle.getTitle()); + featureDef.setDescription(codeAndTitle.getTitle()); String code = codeAndTitle.getCode(); int count = counters.count(code); featureDef.setCode(count == 1 ? code : code + count); diff --git a/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/genedata/GenedataFormatToCanonicalFeatureVector.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/genedata/GenedataFormatToCanonicalFeatureVector.java index c898db97178..9b215c2b5b2 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/genedata/GenedataFormatToCanonicalFeatureVector.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/genedata/GenedataFormatToCanonicalFeatureVector.java @@ -84,7 +84,8 @@ public class GenedataFormatToCanonicalFeatureVector int count = counters.count(name); ImgFeatureDefDTO featureDef = new ImgFeatureDefDTO(); featureDef.setCode(count == 1 ? name : name + count); - featureDef.setName(name); + featureDef.setLabel(name); + featureDef.setDescription(name); featureVector.setFeatureDef(featureDef); PlateFeatureValues valuesValues = convertColumnToValues(geometry, feature); ImgFeatureValuesDTO values = new ImgFeatureValuesDTO(0., 0., valuesValues, 0); diff --git a/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/FeatureTableBuilder.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/FeatureTableBuilder.java index b8d9a74d66e..d1298b70a01 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/FeatureTableBuilder.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/FeatureTableBuilder.java @@ -116,18 +116,18 @@ public class FeatureTableBuilder final Bundle bundle = new Bundle(); final List<ImgFeatureDefDTO> featureDefinitions = dao.listFeatureDefsByDataSetId(dataSet.getId()); - final Map<String, ImgFeatureDefDTO> featureNameToDefMap = + final Map<String, ImgFeatureDefDTO> featureCodeToDefMap = new LinkedHashMap<String, ImgFeatureDefDTO>(); for (ImgFeatureDefDTO def : featureDefinitions) { - featureNameToDefMap.put(def.getName(), def); + featureCodeToDefMap.put(def.getCode(), def); } bundle.dataSet = dataSet; bundle.featureDefToValuesMap = new HashMap<ImgFeatureDefDTO, List<ImgFeatureValuesDTO>>(); bundles.add(bundle); if (useAllFeatures) { - featureNames.addAll(featureNameToDefMap.keySet()); + featureNames.addAll(featureCodeToDefMap.keySet()); } for (String featureName : featureNames) { @@ -136,7 +136,7 @@ public class FeatureTableBuilder featureNameToIndexMap.put(featureName, new Integer(featureNameToIndexMap.size())); } - final ImgFeatureDefDTO featureDefinition = featureNameToDefMap.get(featureName); + final ImgFeatureDefDTO featureDefinition = featureCodeToDefMap.get(featureName); if (featureDefinition != null) { List<ImgFeatureValuesDTO> featureValueSets = @@ -222,8 +222,8 @@ public class FeatureTableBuilder { break; } - Integer index = featureNameToIndexMap.get(featureDefinition.getName()); - assert index != null : "No index for feature " + featureDefinition.getName(); + Integer index = featureNameToIndexMap.get(featureDefinition.getCode()); + assert index != null : "No index for feature " + featureDefinition.getCode(); valueArray[index] = featureValues.getForWellLocation(wellPosition.getWellRow(), wellPosition .getWellColumn()); diff --git a/screening/source/java/ch/systemsx/cisd/openbis/dss/screening/server/DssServiceRpcScreening.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/screening/server/DssServiceRpcScreening.java index ce3d7bba1cf..a83dfdca794 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/dss/screening/server/DssServiceRpcScreening.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/dss/screening/server/DssServiceRpcScreening.java @@ -123,7 +123,7 @@ public class DssServiceRpcScreening extends AbstractDssServiceRpc implements List<ImgFeatureDefDTO> featureDefinitions = getFeatureDefinitions(identifier); for (ImgFeatureDefDTO featureDefinition : featureDefinitions) { - String featureName = featureDefinition.getName(); + String featureName = featureDefinition.getLabel(); if (result.contains(featureName) == false) { result.add(featureName); diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/imaging/dataaccess/ImgFeatureDefDTO.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/imaging/dataaccess/ImgFeatureDefDTO.java index f805891426e..402505c40f1 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/imaging/dataaccess/ImgFeatureDefDTO.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/imaging/dataaccess/ImgFeatureDefDTO.java @@ -32,8 +32,8 @@ public class ImgFeatureDefDTO extends AbstractHashable @AutoGeneratedKeys private long id; - @ResultColumn("NAME") - private String name; + @ResultColumn("LABEL") + private String label; @ResultColumn("CODE") private String code; @@ -48,9 +48,9 @@ public class ImgFeatureDefDTO extends AbstractHashable { } - public ImgFeatureDefDTO(String name, String description, long dataSetId) + public ImgFeatureDefDTO(String label, String description, long dataSetId) { - this.name = name; + this.label = label; this.description = description; this.dataSetId = dataSetId; } @@ -65,14 +65,14 @@ public class ImgFeatureDefDTO extends AbstractHashable this.id = id; } - public String getName() + public String getLabel() { - return name; + return label; } - public void setName(String name) + public void setLabel(String label) { - this.name = name; + this.label = label; } public void setCode(String code) diff --git a/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/etl/featurevector/CsvToCanonicalFeatureVectorTest.java b/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/etl/featurevector/CsvToCanonicalFeatureVectorTest.java index 9575906ecd1..7b22060aa29 100644 --- a/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/etl/featurevector/CsvToCanonicalFeatureVectorTest.java +++ b/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/etl/featurevector/CsvToCanonicalFeatureVectorTest.java @@ -54,7 +54,7 @@ public class CsvToCanonicalFeatureVectorTest extends AssertJUnit // Check total cells feature CanonicalFeatureVector totalCells = fvs.get(0); ImgFeatureDefDTO def = totalCells.getFeatureDef(); - assertEquals("TotalCells", def.getName()); + assertEquals("TotalCells", def.getLabel()); assertEquals(1, totalCells.getValues().size()); ImgFeatureValuesDTO values = totalCells.getValues().get(0); PlateFeatureValues darr = values.getValues(); @@ -66,7 +66,7 @@ public class CsvToCanonicalFeatureVectorTest extends AssertJUnit // Check InfectionIndex CanonicalFeatureVector infectionIndex = fvs.get(2); def = infectionIndex.getFeatureDef(); - assertEquals("InfectionIndex", def.getName()); + assertEquals("InfectionIndex", def.getLabel()); assertEquals(1, infectionIndex.getValues().size()); values = infectionIndex.getValues().get(0); darr = values.getValues(); diff --git a/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/etl/featurevector/FeatureVectorUploaderTest.java b/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/etl/featurevector/FeatureVectorUploaderTest.java index c6bf246977a..ef6e7b5eeff 100644 --- a/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/etl/featurevector/FeatureVectorUploaderTest.java +++ b/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/etl/featurevector/FeatureVectorUploaderTest.java @@ -111,7 +111,7 @@ public class FeatureVectorUploaderTest extends AbstractDBTest private void verifyFeatureDef() { - assertEquals(TEST_FEATURE_NAME + count, featureDef.getName()); + assertEquals(TEST_FEATURE_NAME + count, featureDef.getLabel()); List<ImgFeatureValuesDTO> featureValuesList = dao.getFeatureValues(featureDef); assertEquals(1, featureValuesList.size()); featureValues = featureValuesList.get(0); diff --git a/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/etl/genedata/FeatureStorageProcessorTest.java b/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/etl/genedata/FeatureStorageProcessorTest.java index bd5de1755f2..268f2ae6430 100644 --- a/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/etl/genedata/FeatureStorageProcessorTest.java +++ b/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/etl/genedata/FeatureStorageProcessorTest.java @@ -100,6 +100,7 @@ public class FeatureStorageProcessorTest extends AbstractFileSystemTestCase will(returnValue(datasetId)); ImgFeatureDefDTO featureDTO = new ImgFeatureDefDTO("alpha", "alpha", datasetId); + featureDTO.setCode("alpha"); one(dao).addFeatureDef(with(equal(featureDTO))); will(returnValue((long) 1)); @@ -107,6 +108,7 @@ public class FeatureStorageProcessorTest extends AbstractFileSystemTestCase will(returnValue((long) 1)); featureDTO = new ImgFeatureDefDTO("beta", "beta", datasetId); + featureDTO.setCode("beta"); one(dao).addFeatureDef(with(equal(featureDTO))); will(returnValue((long) 2)); diff --git a/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/etl/genedata/GenedataFormatToCanonicalFeatureVectorTest.java b/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/etl/genedata/GenedataFormatToCanonicalFeatureVectorTest.java index 17ff9db8c62..c91cf5e3999 100644 --- a/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/etl/genedata/GenedataFormatToCanonicalFeatureVectorTest.java +++ b/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/etl/genedata/GenedataFormatToCanonicalFeatureVectorTest.java @@ -66,7 +66,7 @@ public class GenedataFormatToCanonicalFeatureVectorTest extends AbstractFileSyst private void verifyFeature(CanonicalFeatureVector feature, String featureName, float[] values) { ImgFeatureDefDTO featureDef = feature.getFeatureDef(); - assertEquals(featureName, featureDef.getName()); + assertEquals(featureName, featureDef.getLabel()); List<ImgFeatureValuesDTO> featureValues = feature.getValues(); assertEquals(1, featureValues.size()); ImgFeatureValuesDTO featureValue = featureValues.get(0); diff --git a/screening/sourceTest/java/ch/systemsx/cisd/openbis/plugin/screening/shared/imaging/dataaccess/FeatureVectorDAOTest.java b/screening/sourceTest/java/ch/systemsx/cisd/openbis/plugin/screening/shared/imaging/dataaccess/FeatureVectorDAOTest.java index e12e0316b4c..124fe4e0833 100644 --- a/screening/sourceTest/java/ch/systemsx/cisd/openbis/plugin/screening/shared/imaging/dataaccess/FeatureVectorDAOTest.java +++ b/screening/sourceTest/java/ch/systemsx/cisd/openbis/plugin/screening/shared/imaging/dataaccess/FeatureVectorDAOTest.java @@ -104,7 +104,7 @@ public class FeatureVectorDAOTest extends AbstractDBTest assertEquals(1, featureDefs.size()); ImgFeatureDefDTO featureDef = featureDefs.get(0); - assertEquals(TEST_FEATURE_NAME, featureDef.getName()); + assertEquals(TEST_FEATURE_NAME, featureDef.getLabel()); createFeatureValues(featureDef); List<ImgFeatureValuesDTO> featureValuesList = dao.getFeatureValues(featureDef); -- GitLab