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

fix:

- CruiseControl BDS build

SVN: 2378
parent ab2a1917
No related branches found
No related tags found
No related merge requests found
......@@ -18,6 +18,7 @@ package ch.systemsx.cisd.bds.hcs;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import ch.systemsx.cisd.bds.DataStructureException;
......@@ -38,7 +39,11 @@ public final class ChannelList implements IStorable
public ChannelList(final List<Channel> channels)
{
assert channels.size() > 0 : "At least one channel must be specified.";
assert channels != null && channels.size() > 0 : "At least one channel must be specified.";
if (new HashSet<Channel>(channels).size() != channels.size())
{
throw new DataStructureException(String.format("Some duplicate channels in '%s'.", channels));
}
this.channels = channels;
}
......
......@@ -16,12 +16,68 @@
package ch.systemsx.cisd.bds.hcs;
import java.util.ArrayList;
import java.util.List;
import org.testng.annotations.Test;
import static org.testng.AssertJUnit.*;
import ch.systemsx.cisd.bds.DataStructureException;
import ch.systemsx.cisd.bds.storage.IDirectory;
import ch.systemsx.cisd.bds.storage.filesystem.NodeFactory;
import ch.systemsx.cisd.common.utilities.AbstractFileSystemTestCase;
/**
* Test cases for corresponding {@link ChannelList} class.
*
* @author Christian Ribeaud
*/
public final class ChannelListTest
public final class ChannelListTest extends AbstractFileSystemTestCase
{
private final static ChannelList createChannelList()
{
final List<Channel> list = new ArrayList<Channel>();
list.add(new Channel(1, 123));
list.add(new Channel(2, 456));
return new ChannelList(list);
}
@Test
public final void testConstructor()
{
try
{
new ChannelList(null);
fail("Channel list can not be null.");
} catch (AssertionError ex)
{
}
try
{
new ChannelList(new ArrayList<Channel>());
fail("Channel list can not be empty.");
} catch (AssertionError ex)
{
}
final List<Channel> list = new ArrayList<Channel>();
list.add(new Channel(1, 123));
list.add(new Channel(1, 456));
try
{
new ChannelList(list);
fail("Duplicate channels are not allowed.");
} catch (DataStructureException e)
{
}
}
@Test
public final void testSaveTo()
{
final ChannelList channelList = createChannelList();
final IDirectory dir = NodeFactory.createDirectoryNode(workingDirectory);
channelList.saveTo(dir);
}
}
\ No newline at end of file
......@@ -72,8 +72,10 @@ public final class PlateGeometryTest extends AbstractFileSystemTestCase
assertEquals(PlateGeometry.PLATE_GEOMETRY, geometryDir.getName());
files = geometryDir.listFiles();
assertEquals(2, files.length);
assertEquals(PlateGeometry.COLUMNS, files[0].getName());
assertEquals(PlateGeometry.ROWS, files[1].getName());
File file = files[0];
assertTrue(file.getName().equals(Geometry.COLUMNS) || file.getName().equals(Geometry.ROWS));
file = files[1];
assertTrue(file.getName().equals(Geometry.COLUMNS) || file.getName().equals(Geometry.ROWS));
}
@Test(dependsOnMethods = "testSaveTo")
......
......@@ -72,8 +72,10 @@ public final class WellGeometryTest extends AbstractFileSystemTestCase
assertEquals(WellGeometry.WELL_GEOMETRY, geometryDir.getName());
files = geometryDir.listFiles();
assertEquals(2, files.length);
assertEquals(WellGeometry.COLUMNS, files[0].getName());
assertEquals(WellGeometry.ROWS, files[1].getName());
File file = files[0];
assertTrue(file.getName().equals(Geometry.COLUMNS) || file.getName().equals(Geometry.ROWS));
file = files[1];
assertTrue(file.getName().equals(Geometry.COLUMNS) || file.getName().equals(Geometry.ROWS));
}
@Test(dependsOnMethods = "testSaveTo")
......
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