Skip to content

Commit

Permalink
Fixed GitHub actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Rylern committed Nov 7, 2023
1 parent 2c9ea7c commit 867fbe3
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 49 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build_jar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
distribution: 'adopt-hotspot'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Grant execute permission for OMERO server setup script
run: chmod +x src/test/resources/qupath/ext/omero/setupOmeroServer.sh
- name: Build with Gradle
run: ./gradlew build -P toolchain=11
- uses: actions/upload-artifact@v2
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@
distribution: 'adopt-hotspot'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Grant execute permission for OMERO server setup script
run: chmod +x src/test/resources/qupath/ext/omero/setupOmeroServer.sh
- name: Build with Gradle
run: ./gradlew build -P toolchain=11
36 changes: 18 additions & 18 deletions src/test/java/qupath/ext/omero/OmeroServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ protected void waitUntilReady() {
"/analysis.csv"
)
.withFileSystemBind(
Objects.requireNonNull(OmeroServer.class.getResource("Dot_Blot.tif")).getPath(),
"/Dot_Blot.tif"
Objects.requireNonNull(OmeroServer.class.getResource("Cardio.tif")).getPath(),
"/Cardio.tif"
)
.withFileSystemBind(
Objects.requireNonNull(OmeroServer.class.getResource("mitosis.tif")).getPath(),
Expand Down Expand Up @@ -309,33 +309,33 @@ protected static URI getImageURI() {
return URI.create(getServerURL() + "/webclient/?show=image-" + getImage().getId());
}

protected static String getImageAttributeValue(int informationIndex) {
protected static Image getOrphanedImage() {
return new Image(2);
}

protected static String getOrphanedImageAttributeValue(int informationIndex) {
return switch (informationIndex) {
case 0 -> "mitosis.tif";
case 1 -> String.valueOf(getImage().getId());
case 0 -> "Cardio.tif";
case 1 -> String.valueOf(getOrphanedImage().getId());
case 2 -> getCurrentOwner().getFullName();
case 3 -> getCurrentGroup().getName();
case 4, 13 -> "-";
case 5 -> "171 px";
case 6 -> "196 px";
case 7 -> "32.6 MB";
case 8 -> "5";
case 9 -> "2";
case 10 -> "51";
case 11, 12 -> "0.08850000022125 µm";
case 14 -> "uint16";
case 5 -> "1000 px";
case 6 -> "1000 px";
case 7 -> "2.9 MB";
case 8 -> "1";
case 9 -> "3";
case 10 -> "1";
case 11, 12 -> "-";
case 14 -> "uint8";
default -> "";
};
}

protected static int getImageNumberOfAttributes() {
protected static int getOrphanedImageNumberOfAttributes() {
return 15;
}

protected static Image getOrphanedImage() {
return new Image(2);
}

protected static List<Group> getGroups() {
return List.of(
new Group(0, "system"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
import qupath.ext.omero.OmeroServer;
import qupath.ext.omero.core.WebClient;
import qupath.ext.omero.core.WebClients;
import qupath.ext.omero.core.entities.repositoryentities.OrphanedFolder;
import qupath.ext.omero.core.entities.repositoryentities.RepositoryEntity;
import qupath.ext.omero.core.entities.repositoryentities.serverentities.Dataset;
import qupath.ext.omero.core.entities.repositoryentities.serverentities.Project;

import java.util.List;
import java.util.concurrent.ExecutionException;
Expand All @@ -24,34 +23,19 @@ public class TestImage extends OmeroServer {
static void createClient() throws ExecutionException, InterruptedException {
client = OmeroServer.createValidClient();

while (client.getServer().isPopulatingChildren()) {
TimeUnit.MILLISECONDS.sleep(50);
}
Project project = client.getServer().getChildren().stream()
.filter(child -> child instanceof Project)
.map(p -> (Project) p)
.findAny()
.orElse(null);
assert project != null;

List<? extends RepositoryEntity> projectChildren = project.getChildren();
while (project.isPopulatingChildren()) {
TimeUnit.MILLISECONDS.sleep(50);
}

Dataset dataset = projectChildren.stream()
.filter(child -> child instanceof Dataset)
.map(d -> (Dataset) d)
OrphanedFolder orphanedFolder = client.getServer().getChildren().stream()
.filter(child -> child instanceof OrphanedFolder)
.map(p -> (OrphanedFolder) p)
.findAny()
.orElse(null);
assert dataset != null;
assert orphanedFolder != null;

List<? extends RepositoryEntity> datasetChildren = dataset.getChildren();
while (dataset.isPopulatingChildren()) {
List<? extends RepositoryEntity> orphanedFolderChildren = orphanedFolder.getChildren();
while (orphanedFolder.isPopulatingChildren()) {
TimeUnit.MILLISECONDS.sleep(50);
}

image = datasetChildren.stream()
image = orphanedFolderChildren.stream()
.filter(child -> child instanceof Image)
.map(d -> (Image) d)
.findAny()
Expand Down Expand Up @@ -86,10 +70,10 @@ void Check_Children() throws InterruptedException {

@Test
void Check_Attributes() {
int numberOfValues = OmeroServer.getImageNumberOfAttributes();
int numberOfValues = OmeroServer.getOrphanedImageNumberOfAttributes();
String[] expectedAttributeValues = new String[numberOfValues];
for (int i=0; i<numberOfValues; ++i) {
expectedAttributeValues[i] = OmeroServer.getImageAttributeValue(i);
expectedAttributeValues[i] = OmeroServer.getOrphanedImageAttributeValue(i);
}

String[] attributesValues = new String[numberOfValues];
Expand All @@ -102,7 +86,7 @@ void Check_Attributes() {

@Test
void Check_Number_Of_Attributes() {
int expectedNumberOfAttributes = OmeroServer.getImageNumberOfAttributes();
int expectedNumberOfAttributes = OmeroServer.getOrphanedImageNumberOfAttributes();

int numberOfAttributes = image.getNumberOfAttributes();

Expand All @@ -117,16 +101,16 @@ void Check_Supported() {
}

@Test
void Check_Not_Uint8() {
void Check_Uint8() {
boolean isUint8 = image.isUint8();

Assertions.assertFalse(isUint8);
Assertions.assertTrue(isUint8);
}

@Test
void Check_Has_3_channels() {
boolean has3Channels = image.has3Channels();

Assertions.assertFalse(has3Channels);
Assertions.assertTrue(has3Channels);
}
}
Binary file added src/test/resources/qupath/ext/omero/Cardio.tif
Binary file not shown.
Binary file removed src/test/resources/qupath/ext/omero/Dot_Blot.tif
Binary file not shown.
2 changes: 1 addition & 1 deletion src/test/resources/qupath/ext/omero/setupOmeroServer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ file=$(/opt/omero/server/venv3/bin/omero obj new FileAnnotation file=$analysis)
/opt/omero/server/venv3/bin/omero obj new Dataset name=orphaned_dataset

/opt/omero/server/venv3/bin/omero import -d $dataset --transfer=ln_s /mitosis.tif
/opt/omero/server/venv3/bin/omero import --transfer=ln_s /Dot_Blot.tif
/opt/omero/server/venv3/bin/omero import --transfer=ln_s /Cardio.tif

echo $analysis

0 comments on commit 867fbe3

Please sign in to comment.