Skip to content
Snippets Groups Projects
Commit fbe8c1be authored by ribeaudc's avatar ribeaudc
Browse files

fix: - Integration tests.

SVN: 8015
parent 537fde75
No related branches found
No related tags found
No related merge requests found
......@@ -17,7 +17,6 @@
package ch.systemsx.cisd.bds;
import java.io.StringWriter;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.List;
......@@ -171,20 +170,17 @@ public final class DataSet implements IStorable
final String code = Utilities.getTrimmedString(idFolder, CODE);
final String observableTypeCode = Utilities.getTrimmedString(idFolder, OBSERVABLE_TYPE);
final Boolean isMeasured = Utilities.getBoolean(idFolder, IS_MEASURED);
final Date productionTimestampOrNull =
Utilities.tryGetDate(idFolder, PRODUCTION_TIMESTAMP);
final Date productionTimestampOrNull = Utilities.tryGetDate(idFolder, PRODUCTION_TIMESTAMP);
final String producerCode = Utilities.getTrimmedString(idFolder, PRODUCER_CODE);
final List<String> parentCodes = Utilities.getStringList(idFolder, PARENT_CODES);
final String strIsComplete = Utilities.getTrimmedString(idFolder, IS_COMPLETE);
BooleanOrUnknown completeFlag;
try
{
completeFlag = BooleanOrUnknown.valueOf(strIsComplete);
completeFlag = BooleanOrUnknown.getByNiceRepresentation(strIsComplete);
} catch (final IllegalArgumentException ex)
{
throw new DataStructureException(String.format(
"'%s' value must be one of '%s' but is '%s'.", IS_COMPLETE, Arrays
.asList(BooleanOrUnknown.values()), strIsComplete));
throw new DataStructureException(ex.getMessage());
}
assert completeFlag != null : "Complete flag not specified.";
final DataSet dataSet =
......@@ -208,7 +204,7 @@ public final class DataSet implements IStorable
folder.addKeyValuePair(PRODUCER_CODE, StringUtils.emptyIfNull(producerCode));
folder.addKeyValuePair(IS_MEASURED, isMeasured.toString());
folder.addKeyValuePair(OBSERVABLE_TYPE, observableTypeCode);
folder.addKeyValuePair(IS_COMPLETE, isComplete.toString());
folder.addKeyValuePair(IS_COMPLETE, isComplete.getNiceRepresentation());
final String value;
if (parentCodes.size() > 0)
{
......
......@@ -43,6 +43,23 @@ public enum BooleanOrUnknown
return niceRepresentation;
}
public final static BooleanOrUnknown getByNiceRepresentation(final String niceRepresentation)
{
if (niceRepresentation.equals("FALSE"))
{
return F;
}
if (niceRepresentation.equals("TRUE"))
{
return T;
}
if (niceRepresentation.equals("UNKNOWN"))
{
return U;
}
throw new IllegalArgumentException(String.format("Given nice representation '%s' unknown."));
}
/**
* Resolve the specified boolean flag to either {@link #T} or {@link #F}.
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment