Skip to content
Snippets Groups Projects
Commit 6f47eecf authored by felmer's avatar felmer
Browse files

SSDM-4187: do no allow sample code alone without default sapce or home space....

SSDM-4187: do no allow sample code alone without default sapce or home space. This should fix uitest.

SVN: 37524
parent 7ebdd27c
No related branches found
No related tags found
No related merge requests found
......@@ -35,6 +35,7 @@ public class NormalizedSampleIdentifier
private String space;
private String project;
private String code;
private boolean codeOnly;
private void extractPartsFrom(String identifier)
{
......@@ -57,6 +58,7 @@ public class NormalizedSampleIdentifier
} else
{
code = identifier;
codeOnly = true;
}
}
......@@ -123,19 +125,22 @@ public class NormalizedSampleIdentifier
String identifier = sample.getIdentifier().toUpperCase();
identifierParts.extractPartsFrom(identifier);
if (identifierParts.space == null)
if (identifierParts.codeOnly)
{
identifierParts.space = normalizeSpaceCode(sample.getDefaultSpaceIdentifier());
}
if (identifierParts.space == null)
{
identifierParts.space = normalizeSpaceCode(homeSpace);
}
if (identifierParts.space == null)
{
// throw UserFailureException.fromTemplate("Cannot determine space for sample " + sample);
if (identifierParts.space == null)
{
identifierParts.space = normalizeSpaceCode(sample.getDefaultSpaceIdentifier());
}
if (identifierParts.space == null)
{
identifierParts.space = normalizeSpaceCode(homeSpace);
}
if (identifierParts.space == null)
{
throw UserFailureException.fromTemplate("Cannot determine space for sample " + sample);
}
}
if (identifierParts.code.contains(":"))
......
......@@ -57,6 +57,21 @@ public class NormalizedSampleIdentifierTest
assertEquals(identifier.getContainerCode(), null);
}
@Test
public void testNewSharedSampleWithCodeNoHomeSpaceNoDefaultSpace()
{
newSample.setIdentifier("a");
newSample.setDefaultSpaceIdentifier(null);
try
{
new NormalizedSampleIdentifier(newSample, null);
} catch (UserFailureException ex)
{
assertEquals(ex.getMessage(), "Cannot determine space for sample A");
}
}
@Test
public void testNewSharedSampleComponent()
{
......
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