use of net.imagej.table.DefaultGenericTable in project imagej-omero by imagej.
the class UploadTableTest method testByteArrayTable.
@Test
public void testByteArrayTable() throws ServerError, PermissionDeniedException, CannotCreateSessionException, ExecutionException, DSOutOfServiceException, DSAccessException {
final GenericTable table = new DefaultGenericTable();
final DefaultColumn<ByteArray> ij0 = new DefaultColumn<>(ByteArray.class);
final DefaultColumn<ByteArray> ij1 = new DefaultColumn<>(ByteArray.class);
ij0.add(new ByteArray(new byte[] { -128, 127 }));
ij0.add(new ByteArray(new byte[] { 0, 10 }));
ij1.add(new ByteArray(new byte[] { 112, 42 }));
ij1.add(new ByteArray(new byte[] { -13, -84 }));
table.add(ij0);
table.add(ij1);
// Create expectations
setUpMethodCalls();
final long id = service.uploadTable(credentials, "table", table, 0);
assertEquals(id, -1);
// NB: Can only capture in a Verifications block
new Verifications() {
{
TableData td;
tablesFacility.addTable((SecurityContext) any, (ImageData) any, anyString, td = withCapture());
tableEquals(table, td, Long[].class);
}
};
}
use of net.imagej.table.DefaultGenericTable in project imagej-omero by imagej.
the class UploadTableTest method testReferenceTable.
@Test
public void testReferenceTable() throws ServerError, PermissionDeniedException, CannotCreateSessionException, ExecutionException, DSOutOfServiceException, DSAccessException {
final GenericTable table = new DefaultGenericTable();
final OMERORefColumn rc0 = new OMERORefColumn(OMERORef.WELL);
final OMERORefColumn rc1 = new OMERORefColumn(OMERORef.WELL);
final OMERORefColumn rc2 = new OMERORefColumn(OMERORef.WELL);
rc0.fill(new long[] { 2314, 3141324, 1235 });
rc1.fill(new long[] { 1234, 18367, 82156 });
rc2.fill(new long[] { 3198, 968431, 5489 });
table.add(rc0);
table.add(rc1);
table.add(rc2);
final Object[][] wells = new Object[3][3];
for (int c = 0; c < table.getColumnCount(); c++) {
for (int r = 0; r < table.getRowCount(); r++) {
wells[c][r] = new WellSampleData(new WellSampleI((long) table.get(c, r), false));
}
((OMERORefColumn) table.get(c)).setOriginalData(wells[c]);
}
// Create expectations
setUpMethodCalls();
final long id = service.uploadTable(credentials, "table", table, 0);
assertEquals(id, -1);
// NB: Can only capture in a Verifications block
new Verifications() {
{
TableData td;
tablesFacility.addTable((SecurityContext) any, (ImageData) any, anyString, td = withCapture());
tableEquals(table, td, WellSampleData.class);
}
};
}
use of net.imagej.table.DefaultGenericTable in project imagej-omero by imagej.
the class UploadTableTest method testDoubleArrayTable.
@Test
public void testDoubleArrayTable() throws ServerError, PermissionDeniedException, CannotCreateSessionException, ExecutionException, DSOutOfServiceException, DSAccessException {
final GenericTable table = new DefaultGenericTable();
final DefaultColumn<DoubleArray> ij0 = new DefaultColumn<>(DoubleArray.class, "H1");
final DefaultColumn<DoubleArray> ij1 = new DefaultColumn<>(DoubleArray.class, "H2");
ij0.add(new DoubleArray(new double[] { 0.5, 0.25, 0.125 }));
ij1.add(new DoubleArray(new double[] { -0.125, -0.0625, 0.03125 }));
table.add(ij0);
table.add(ij1);
// Create expectations
setUpMethodCalls();
final long id = service.uploadTable(credentials, "table", table, 0);
assertEquals(id, -1);
// NB: Can only capture in a Verifications block
new Verifications() {
{
TableData td;
tablesFacility.addTable((SecurityContext) any, (ImageData) any, anyString, td = withCapture());
tableEquals(table, td, Double[].class);
}
};
}
use of net.imagej.table.DefaultGenericTable in project imagej-omero by imagej.
the class UploadTableTest method testMixedTable.
@Test
public void testMixedTable() throws ServerError, PermissionDeniedException, CannotCreateSessionException, ExecutionException, DSOutOfServiceException, DSAccessException {
final GenericTable table = new DefaultGenericTable();
final BoolColumn ijc0 = new BoolColumn("h0");
final DoubleColumn ijc1 = new DoubleColumn("h1");
final DefaultColumn<String> ijc2 = new DefaultColumn<>(String.class, "h2");
final DefaultColumn<IntArray> ijc3 = new DefaultColumn<>(IntArray.class, "h3");
final OMERORefColumn ijc4 = new OMERORefColumn("h4", OMERORef.ROI);
ijc0.fill(new boolean[] { true, false });
ijc1.fill(new double[] { 0.03125, -2134.5 });
ijc2.add("abc");
ijc2.add("123");
ijc3.add(new IntArray(new int[] { 9012, 1294 }));
ijc3.add(new IntArray(new int[] { -4123, -9 }));
ijc4.fill(new long[] { 2314, 1234 });
ijc4.setOriginalData(new Object[] { new ROIData(new RoiI(2314, true)), new ROIData(new RoiI(1234, true)) });
table.add(ijc0);
table.add(ijc1);
table.add(ijc2);
table.add(ijc3);
table.add(ijc4);
// Create expectations
setUpMethodCalls();
final long id = service.uploadTable(credentials, "table", table, 0);
assertEquals(id, -1);
// NB: Can only capture in a Verifications block
new Verifications() {
{
TableData td;
tablesFacility.addTable((SecurityContext) any, (ImageData) any, anyString, td = withCapture());
tableEquals(table, td, Boolean.class, Double.class, String.class, Long[].class, ROIData.class);
}
};
}
Aggregations