Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fslite test #6

Merged
merged 10 commits into from
Oct 2, 2012
6 changes: 4 additions & 2 deletions components/blitz/src/ome/formats/importer/ImportLibrary.java
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,10 @@ private RepositoryImportContainer createRepositoryImportContainer(ImportContaine
repoIC.target = ic.getTarget();
repoIC.reader = ic.getReader();
repoIC.usedFiles = ic.getUsedFiles();
repoIC.isSPW = ic.getIsSPW();
repoIC.bfImageCount = ic.getBfImageCount();
repoIC.isSPW = (ic.getIsSPW() == null) ? false :
ic.getIsSPW().booleanValue();
repoIC.bfImageCount = (ic.getBfImageCount() == null) ? 1 :
ic.getBfImageCount().intValue();
repoIC.bfPixels = ic.getBfPixels();
repoIC.bfImageNames = ic.getBfImageNames();
// Assuming that if the array is not null all values are not null.
Expand Down
60 changes: 46 additions & 14 deletions components/tools/OmeroJava/test/integration/AbstractServerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@
import java.util.UUID;

import ome.formats.OMEROMetadataStoreClient;
import ome.formats.importer.IObservable;
import ome.formats.importer.IObserver;
import ome.formats.importer.ImportCandidates;
import ome.formats.importer.ImportConfig;
import ome.formats.importer.ImportContainer;
import ome.formats.importer.ImportEvent;
import ome.formats.importer.ImportLibrary;
import ome.formats.importer.OMEROWrapper;
import omero.ApiUsageException;
Expand All @@ -29,9 +33,6 @@
import omero.api.IQueryPrx;
import omero.api.IUpdatePrx;
import omero.api.ServiceFactoryPrx;
import omero.api.delete.DeleteCommand;
import omero.api.delete.DeleteHandlePrx;
import omero.api.delete.DeleteReport;
import omero.cmd.Chmod;
import omero.cmd.CmdCallbackI;
import omero.cmd.Delete;
Expand All @@ -45,7 +46,6 @@
import omero.cmd.Response;
import omero.cmd.State;
import omero.cmd.Status;
import omero.grid.DeleteCallbackI;
import omero.model.BooleanAnnotation;
import omero.model.BooleanAnnotationI;
import omero.model.ChannelBinding;
Expand Down Expand Up @@ -103,6 +103,7 @@
import org.testng.annotations.Test;

import spec.AbstractTest;

//Application-internal dependencies

/**
Expand Down Expand Up @@ -204,7 +205,6 @@ protected omero.client newRootOmeroClient()
return client;
}


/**
* Initializes the various services.
* @throws Exception Thrown if an error occurred.
Expand Down Expand Up @@ -927,14 +927,27 @@ protected List<Pixels> importFile(OMEROMetadataStoreClient importer,
File file, String format, boolean metadata, IObject target)
throws Throwable
{
ImportLibrary library = new ImportLibrary(importer,
new OMEROWrapper(new ImportConfig()));
String[] paths = new String[1];
paths[0] = file.getAbsolutePath();
ImportConfig config = new ImportConfig();
OMEROWrapper reader = new OMEROWrapper(config);
IObserver o = new IObserver() {
public void update(IObservable importLibrary, ImportEvent event) {

}
};
ImportCandidates candidates = new ImportCandidates(reader, paths, o);

ImportLibrary library = new ImportLibrary(importer, reader);
library.setMetadataOnly(metadata);
ImportContainer container = new ImportContainer(
file, null, target, false, null, null, null, null);
container.setUseMetadataFile(true);
container.setCustomImageName(format);
List<Pixels> pixels = library.importImage(container, 0, 0, 1);
ImportContainer ic = candidates.getContainers().get(0);
//new ImportContainer(
// file, null, target, false, null, null, null, null);
ic.setUseMetadataFile(true);
ic.setCustomImageName(format);
ic.setTarget(target);
//ic = library.uploadFilesToRepository(ic);
List<Pixels> pixels = library.importImage(ic, 0, 0, 1);
assertNotNull(pixels);
assertTrue(pixels.size() > 0);
return pixels;
Expand Down Expand Up @@ -974,7 +987,7 @@ protected String delete(boolean passes, omero.client c,
InterruptedException
{

CmdCallbackI cb = callback(passes, c, dc);
callback(passes, c, dc);
return "ok";
}

Expand Down Expand Up @@ -1053,7 +1066,6 @@ protected Image createBinaryImage() throws Exception {
*/
protected Image createBinaryImage(Image image) throws Exception {
Pixels pixels = image.getPrimaryPixels();
long id = pixels.getId().getValue();
//Image
List<Long> ids = new ArrayList<Long>();
ids.add(image.getId().getValue());
Expand Down Expand Up @@ -1576,4 +1588,24 @@ protected Response assertCmd(CmdCallbackI cb, boolean pass) {
return rsp;
}

/**
* Creates a new group with the specified permissions and sets the role
* of the user.
*
* @param permissions The permissions of the group.
* @param userRole The role of the user e.g. group owner.
* @throws Exception Thrown if an error occurred.
*/
protected void login(String permissions, int userRole)
throws Exception
{
newUserAndGroup(permissions);
switch (userRole) {
case GROUP_OWNER:
makeGroupOwner();
break;
case ADMIN:
logRootIntoGroup();
}
}
}