Skip to content

Commit

Permalink
Merge pull request ome#6358 from dominikl/loadfacility_tests
Browse files Browse the repository at this point in the history
Loadfacility tests
  • Loading branch information
jburel authored Dec 14, 2023
2 parents 32ef93b + 1ebe0fa commit 508b504
Showing 1 changed file with 38 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import omero.gateway.SecurityContext;
import omero.gateway.exception.DSAccessException;
import omero.gateway.exception.DSOutOfServiceException;
import omero.gateway.facility.BrowseFacility;
import omero.gateway.model.DatasetData;
import omero.gateway.model.ExperimenterData;
import omero.gateway.model.GroupData;
Expand All @@ -39,8 +38,8 @@
import org.testng.annotations.Test;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

/**
*
Expand Down Expand Up @@ -74,18 +73,36 @@ public void testGetDataset() throws DSOutOfServiceException, DSAccessException {
Assert.assertEquals(obj.getName(), this.ds.getName());
}

@Test
public void testGetDatasetsForPlate() throws DSOutOfServiceException, DSAccessException {
DatasetData obj = this.loadFacility.getDatasets(this.ctx, this.proj.getId()).iterator().next();
Assert.assertEquals(obj.getName(), this.ds.getName());
}

@Test
public void testGetImage() throws DSOutOfServiceException, DSAccessException {
ImageData obj = this.loadFacility.getImage(this.ctx, this.img.getId());
Assert.assertEquals(obj.getName(), this.img.getName());
}

@Test
public void testGetImagesForDataset() throws DSOutOfServiceException, DSAccessException {
ImageData obj = this.loadFacility.getImages(this.ctx, this.ds.getId()).iterator().next();
Assert.assertEquals(obj.getName(), this.img.getName());
}

@Test
public void testGetPlate() throws DSOutOfServiceException, DSAccessException {
PlateData obj = this.loadFacility.getPlate(this.ctx, this.plate.getId());
Assert.assertEquals(obj.getName(), this.plate.getName());
}

@Test
public void testGetPlatesForScreen() throws DSOutOfServiceException, DSAccessException {
PlateData obj = this.loadFacility.getPlates(this.ctx, this.screen.getId()).iterator().next();
Assert.assertEquals(obj.getName(), this.plate.getName());
}

@Test
public void testGetProject() throws DSOutOfServiceException, DSAccessException {
ProjectData obj = this.loadFacility.getProject(this.ctx, this.proj.getId());
Expand All @@ -107,19 +124,33 @@ public void testGetWell() throws DSOutOfServiceException, DSAccessException {
Assert.assertEquals(obj.getWellSamples().get(0).getImage().getId(),
test.getWellSamples().get(0).getImage().getId());
}

@Test
public void testGetWellsForPlate() throws DSOutOfServiceException, DSAccessException {
Set<String> test = new HashSet<>();
for (WellData w : this.plate.getWells()) {
String key = w.getColumn()+"|"+w.getRow()+"|"+w.getId();
test.add(key);
}
for (WellData w : this.loadFacility.getWells(this.ctx, this.plate.getId())) {
String key = w.getColumn()+"|"+w.getRow()+"|"+w.getId();
Assert.assertTrue(test.contains(key));
test.remove(key);
}
Assert.assertTrue(test.isEmpty());
}

private void initData() throws Exception {
this.group = createGroup();
this.user = createExperimenter(group);
this.ctx = new SecurityContext(group.getId());

this.img = createImage(ctx, null);

this.proj = createProject(ctx);
this.ds = createDataset(ctx, null);
this.ds = createDataset(ctx, proj);
this.img = createImage(ctx, ds);

this.screen = createScreen(ctx);
this.plate = createPlateWithWells(ctx, screen);

this.wellIds = new ArrayList<Long>();
Plate p = this.plate.asPlate();
for (Well w : p.copyWells()) {
Expand Down

0 comments on commit 508b504

Please sign in to comment.