Skip to content

Commit 43c5f08

Browse files
committed
iRODS: Fix tests
1 parent 236871a commit 43c5f08

15 files changed

+195
-91
lines changed

irods/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@
4141
<scope>test</scope>
4242
<version>${project.version}</version>
4343
</dependency>
44+
<dependency>
45+
<artifactId>testcontainers</artifactId>
46+
<groupId>org.testcontainers</groupId>
47+
<version>1.21.3</version>
48+
<scope>test</scope>
49+
</dependency>
4450
</dependencies>
4551

4652
<build>

irods/src/test/java/ch/cyberduck/core/irods/IRODSAttributesFinderFeatureTest.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@
2929
import ch.cyberduck.core.proxy.DisabledProxyFinder;
3030
import ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader;
3131
import ch.cyberduck.core.transfer.TransferStatus;
32-
import ch.cyberduck.test.IntegrationTest;
33-
import ch.cyberduck.test.VaultTest;
32+
import ch.cyberduck.test.TestcontainerTest;
3433

3534
import org.junit.Test;
3635
import org.junit.experimental.categories.Category;
@@ -43,14 +42,14 @@
4342
import static org.junit.Assert.assertEquals;
4443
import static org.junit.Assert.assertFalse;
4544

46-
@Category(IntegrationTest.class)
47-
public class IRODSAttributesFinderFeatureTest extends VaultTest {
45+
@Category(TestcontainerTest.class)
46+
public class IRODSAttributesFinderFeatureTest extends IRODSDockerComposeManager {
4847

4948
@Test(expected = NotfoundException.class)
5049
public void testFindNotFound() throws Exception {
5150
final ProtocolFactory factory = new ProtocolFactory(new HashSet<>(Collections.singleton(new IRODSProtocol())));
5251
final Profile profile = new ProfilePlistReader(factory).read(
53-
this.getClass().getResourceAsStream("/iRODS (iPlant Collaborative).cyberduckprofile"));
52+
this.getClass().getResourceAsStream("/iRODS.cyberduckprofile"));
5453
final Host host = new Host(profile, profile.getDefaultHostname(), new Credentials(
5554
PROPERTIES.get("irods.key"), PROPERTIES.get("irods.secret")
5655
));
@@ -64,7 +63,7 @@ public void testFindNotFound() throws Exception {
6463
public void testFind() throws Exception {
6564
final ProtocolFactory factory = new ProtocolFactory(new HashSet<>(Collections.singleton(new IRODSProtocol())));
6665
final Profile profile = new ProfilePlistReader(factory).read(
67-
this.getClass().getResourceAsStream("/iRODS (iPlant Collaborative).cyberduckprofile"));
66+
this.getClass().getResourceAsStream("/iRODS.cyberduckprofile"));
6867
final Host host = new Host(profile, profile.getDefaultHostname(), new Credentials(
6968
PROPERTIES.get("irods.key"), PROPERTIES.get("irods.secret")
7069
));
@@ -81,8 +80,6 @@ public void testFind() throws Exception {
8180
assertEquals(folderTimestamp, f.find(folder).getModificationDate());
8281
final PathAttributes attributes = f.find(test);
8382
assertEquals(0L, attributes.getSize());
84-
assertEquals("iterate", attributes.getOwner());
85-
assertEquals("iplant", attributes.getGroup());
8683
new IRODSDeleteFeature(session).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback());
8784
assertFalse(new IRODSFindFeature(session).find(test));
8885
session.close();

irods/src/test/java/ch/cyberduck/core/irods/IRODSCopyFeatureTest.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@
3131
import ch.cyberduck.core.proxy.DisabledProxyFinder;
3232
import ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader;
3333
import ch.cyberduck.core.transfer.TransferStatus;
34-
import ch.cyberduck.test.IntegrationTest;
35-
import ch.cyberduck.test.VaultTest;
34+
import ch.cyberduck.test.TestcontainerTest;
3635

3736
import org.junit.Test;
3837
import org.junit.experimental.categories.Category;
@@ -45,14 +44,14 @@
4544

4645
import static org.junit.Assert.assertTrue;
4746

48-
@Category(IntegrationTest.class)
49-
public class IRODSCopyFeatureTest extends VaultTest {
47+
@Category(TestcontainerTest.class)
48+
public class IRODSCopyFeatureTest extends IRODSDockerComposeManager {
5049

5150
@Test
5251
public void testCopy() throws Exception {
5352
final ProtocolFactory factory = new ProtocolFactory(new HashSet<>(Collections.singleton(new IRODSProtocol())));
5453
final Profile profile = new ProfilePlistReader(factory).read(
55-
this.getClass().getResourceAsStream("/iRODS (iPlant Collaborative).cyberduckprofile"));
54+
this.getClass().getResourceAsStream("/iRODS.cyberduckprofile"));
5655
final Host host = new Host(profile, profile.getDefaultHostname(), new Credentials(
5756
PROPERTIES.get("irods.key"), PROPERTIES.get("irods.secret")
5857
));

irods/src/test/java/ch/cyberduck/core/irods/IRODSDeleteFeatureTest.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@
3030
import ch.cyberduck.core.proxy.DisabledProxyFinder;
3131
import ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader;
3232
import ch.cyberduck.core.transfer.TransferStatus;
33-
import ch.cyberduck.test.IntegrationTest;
34-
import ch.cyberduck.test.VaultTest;
33+
import ch.cyberduck.test.TestcontainerTest;
3534

3635
import org.junit.Test;
3736
import org.junit.experimental.categories.Category;
@@ -44,14 +43,14 @@
4443
import static org.junit.Assert.assertFalse;
4544
import static org.junit.Assert.assertTrue;
4645

47-
@Category(IntegrationTest.class)
48-
public class IRODSDeleteFeatureTest extends VaultTest {
46+
@Category(TestcontainerTest.class)
47+
public class IRODSDeleteFeatureTest extends IRODSDockerComposeManager {
4948

5049
@Test
5150
public void testDeleteDirectory() throws Exception {
5251
final ProtocolFactory factory = new ProtocolFactory(new HashSet<>(Collections.singleton(new IRODSProtocol())));
5352
final Profile profile = new ProfilePlistReader(factory).read(
54-
this.getClass().getResourceAsStream("/iRODS (iPlant Collaborative).cyberduckprofile"));
53+
this.getClass().getResourceAsStream("/iRODS.cyberduckprofile"));
5554
final Host host = new Host(profile, profile.getDefaultHostname(), new Credentials(
5655
PROPERTIES.get("irods.key"), PROPERTIES.get("irods.secret")
5756
));
@@ -76,7 +75,7 @@ public void testDeleteDirectory() throws Exception {
7675
public void testDeleteNotFound() throws Exception {
7776
final ProtocolFactory factory = new ProtocolFactory(new HashSet<>(Collections.singleton(new IRODSProtocol())));
7877
final Profile profile = new ProfilePlistReader(factory).read(
79-
this.getClass().getResourceAsStream("/iRODS (iPlant Collaborative).cyberduckprofile"));
78+
this.getClass().getResourceAsStream("/iRODS.cyberduckprofile"));
8079
final Host host = new Host(profile, profile.getDefaultHostname(), new Credentials(
8180
PROPERTIES.get("irods.key"), PROPERTIES.get("irods.secret")
8281
));

irods/src/test/java/ch/cyberduck/core/irods/IRODSDirectoryFeatureTest.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@
3131
import ch.cyberduck.core.proxy.DisabledProxyFinder;
3232
import ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader;
3333
import ch.cyberduck.core.transfer.TransferStatus;
34-
import ch.cyberduck.test.IntegrationTest;
35-
import ch.cyberduck.test.VaultTest;
34+
import ch.cyberduck.test.TestcontainerTest;
3635

3736
import org.junit.Test;
3837
import org.junit.experimental.categories.Category;
@@ -45,14 +44,14 @@
4544
import static org.junit.Assert.assertFalse;
4645
import static org.junit.Assert.assertTrue;
4746

48-
@Category(IntegrationTest.class)
49-
public class IRODSDirectoryFeatureTest extends VaultTest {
47+
@Category(TestcontainerTest.class)
48+
public class IRODSDirectoryFeatureTest extends IRODSDockerComposeManager {
5049

5150
@Test
5251
public void testMakeDirectory() throws Exception {
5352
final ProtocolFactory factory = new ProtocolFactory(new HashSet<>(Collections.singleton(new IRODSProtocol())));
5453
final Profile profile = new ProfilePlistReader(factory).read(
55-
this.getClass().getResourceAsStream("/iRODS (iPlant Collaborative).cyberduckprofile"));
54+
this.getClass().getResourceAsStream("/iRODS.cyberduckprofile"));
5655
final Host host = new Host(profile, profile.getDefaultHostname(), new Credentials(
5756
PROPERTIES.get("irods.key"), PROPERTIES.get("irods.secret")
5857
));
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package ch.cyberduck.core.irods;
2+
3+
/*
4+
* Copyright (c) 2002-2025 iterate GmbH. All rights reserved.
5+
* https://cyberduck.io/
6+
*
7+
* This program is free software; you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*/
17+
18+
import ch.cyberduck.test.TestcontainerTest;
19+
20+
import org.junit.experimental.categories.Category;
21+
import org.testcontainers.containers.ComposeContainer;
22+
import org.testcontainers.containers.wait.strategy.Wait;
23+
24+
import java.io.File;
25+
import java.util.HashMap;
26+
import java.util.Map;
27+
28+
@Category(TestcontainerTest.class)
29+
public abstract class IRODSDockerComposeManager {
30+
31+
private static final ComposeContainer container;
32+
33+
// Launch the docker compose project once and run all tests against that environment.
34+
// Ryuk will clean it up at the end of the run.
35+
static {
36+
container = new ComposeContainer(
37+
new File(IRODSDockerComposeManager.class.getResource("/docker/docker-compose.yml").getFile()))
38+
.withPull(false)
39+
.withLocalCompose(true)
40+
.withExposedService("irods-catalog-provider-1", 1247, Wait.forLogMessage(".*\"log_message\":\"Initializing delay server.\".*", 1));
41+
42+
container.start();
43+
}
44+
45+
protected static final Map<String, String> PROPERTIES = new HashMap<String, String>() {{
46+
put("irods.key", "rods");
47+
put("irods.secret", "rods");
48+
}};
49+
50+
}

irods/src/test/java/ch/cyberduck/core/irods/IRODSFindFeatureTest.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@
2929
import ch.cyberduck.core.proxy.DisabledProxyFinder;
3030
import ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader;
3131
import ch.cyberduck.core.transfer.TransferStatus;
32-
import ch.cyberduck.test.IntegrationTest;
33-
import ch.cyberduck.test.VaultTest;
32+
import ch.cyberduck.test.TestcontainerTest;
3433

3534
import org.junit.Test;
3635
import org.junit.experimental.categories.Category;
@@ -43,14 +42,14 @@
4342
import static org.junit.Assert.assertFalse;
4443
import static org.junit.Assert.assertTrue;
4544

46-
@Category(IntegrationTest.class)
47-
public class IRODSFindFeatureTest extends VaultTest {
45+
@Category(TestcontainerTest.class)
46+
public class IRODSFindFeatureTest extends IRODSDockerComposeManager {
4847

4948
@Test
5049
public void testFind() throws Exception {
5150
final ProtocolFactory factory = new ProtocolFactory(new HashSet<>(Collections.singleton(new IRODSProtocol())));
5251
final Profile profile = new ProfilePlistReader(factory).read(
53-
this.getClass().getResourceAsStream("/iRODS (iPlant Collaborative).cyberduckprofile"));
52+
this.getClass().getResourceAsStream("/iRODS.cyberduckprofile"));
5453
final Host host = new Host(profile, profile.getDefaultHostname(), new Credentials(
5554
PROPERTIES.get("irods.key"), PROPERTIES.get("irods.secret")
5655
));

irods/src/test/java/ch/cyberduck/core/irods/IRODSListServiceTest.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,8 @@
3030
import ch.cyberduck.core.exception.NotfoundException;
3131
import ch.cyberduck.core.proxy.DisabledProxyFinder;
3232
import ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader;
33-
import ch.cyberduck.test.IntegrationTest;
34-
import ch.cyberduck.test.VaultTest;
33+
import ch.cyberduck.test.TestcontainerTest;
3534

36-
import org.junit.Ignore;
3735
import org.junit.Test;
3836
import org.junit.experimental.categories.Category;
3937

@@ -44,15 +42,14 @@
4442

4543
import static org.junit.Assert.*;
4644

47-
@Category(IntegrationTest.class)
48-
public class IRODSListServiceTest extends VaultTest {
45+
@Category(TestcontainerTest.class)
46+
public class IRODSListServiceTest extends IRODSDockerComposeManager {
4947

5048
@Test
51-
@Ignore
5249
public void testList() throws Exception {
5350
final ProtocolFactory factory = new ProtocolFactory(new HashSet<>(Collections.singleton(new IRODSProtocol())));
5451
final Profile profile = new ProfilePlistReader(factory).read(
55-
this.getClass().getResourceAsStream("/iRODS (iPlant Collaborative).cyberduckprofile"));
52+
this.getClass().getResourceAsStream("/iRODS.cyberduckprofile"));
5653
final Host host = new Host(profile, profile.getDefaultHostname(), new Credentials(
5754
PROPERTIES.get("irods.key"), PROPERTIES.get("irods.secret")
5855
));
@@ -64,7 +61,7 @@ public void testList() throws Exception {
6461
assertNotNull(session.getClient());
6562
session.login(new DisabledLoginCallback(), new DisabledCancelCallback());
6663
final AttributedList<Path> list = new IRODSListService(session).list(new IRODSHomeFinderService(session).find(), new DisabledListProgressListener());
67-
assertFalse(list.isEmpty());
64+
assertTrue(list.isEmpty());
6865
for(Path p : list) {
6966
assertEquals(new IRODSHomeFinderService(session).find(), p.getParent());
7067
assertNotEquals(-1L, p.attributes().getModificationDate());
@@ -77,7 +74,7 @@ public void testList() throws Exception {
7774
public void testListNotfound() throws Exception {
7875
final ProtocolFactory factory = new ProtocolFactory(new HashSet<>(Collections.singleton(new IRODSProtocol())));
7976
final Profile profile = new ProfilePlistReader(factory).read(
80-
this.getClass().getResourceAsStream("/iRODS (iPlant Collaborative).cyberduckprofile"));
77+
this.getClass().getResourceAsStream("/iRODS.cyberduckprofile"));
8178
final Host host = new Host(profile, profile.getDefaultHostname(), new Credentials(
8279
PROPERTIES.get("irods.key"), PROPERTIES.get("irods.secret")
8380
));

irods/src/test/java/ch/cyberduck/core/irods/IRODSMoveFeatureTest.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@
3333
import ch.cyberduck.core.proxy.DisabledProxyFinder;
3434
import ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader;
3535
import ch.cyberduck.core.transfer.TransferStatus;
36-
import ch.cyberduck.test.IntegrationTest;
37-
import ch.cyberduck.test.VaultTest;
36+
import ch.cyberduck.test.TestcontainerTest;
3837

3938
import org.junit.Test;
4039
import org.junit.experimental.categories.Category;
@@ -46,14 +45,14 @@
4645
import static org.junit.Assert.assertFalse;
4746
import static org.junit.Assert.assertTrue;
4847

49-
@Category(IntegrationTest.class)
50-
public class IRODSMoveFeatureTest extends VaultTest {
48+
@Category(TestcontainerTest.class)
49+
public class IRODSMoveFeatureTest extends IRODSDockerComposeManager {
5150

5251
@Test
5352
public void testMoveDirectory() throws Exception {
5453
final ProtocolFactory factory = new ProtocolFactory(new HashSet<>(Collections.singleton(new IRODSProtocol())));
5554
final Profile profile = new ProfilePlistReader(factory).read(
56-
this.getClass().getResourceAsStream("/iRODS (iPlant Collaborative).cyberduckprofile"));
55+
this.getClass().getResourceAsStream("/iRODS.cyberduckprofile"));
5756
final Host host = new Host(profile, profile.getDefaultHostname(), new Credentials(
5857
PROPERTIES.get("irods.key"), PROPERTIES.get("irods.secret")
5958
));
@@ -83,7 +82,7 @@ public void testMoveDirectory() throws Exception {
8382
public void testMoveFile() throws Exception {
8483
final ProtocolFactory factory = new ProtocolFactory(new HashSet<>(Collections.singleton(new IRODSProtocol())));
8584
final Profile profile = new ProfilePlistReader(factory).read(
86-
this.getClass().getResourceAsStream("/iRODS (iPlant Collaborative).cyberduckprofile"));
85+
this.getClass().getResourceAsStream("/iRODS.cyberduckprofile"));
8786
final Host host = new Host(profile, profile.getDefaultHostname(), new Credentials(
8887
PROPERTIES.get("irods.key"), PROPERTIES.get("irods.secret")
8988
));
@@ -108,7 +107,7 @@ public void testMoveFile() throws Exception {
108107
public void testMoveNotFound() throws Exception {
109108
final ProtocolFactory factory = new ProtocolFactory(new HashSet<>(Collections.singleton(new IRODSProtocol())));
110109
final Profile profile = new ProfilePlistReader(factory).read(
111-
this.getClass().getResourceAsStream("/iRODS (iPlant Collaborative).cyberduckprofile"));
110+
this.getClass().getResourceAsStream("/iRODS.cyberduckprofile"));
112111
final Host host = new Host(profile, profile.getDefaultHostname(), new Credentials(
113112
PROPERTIES.get("irods.key"), PROPERTIES.get("irods.secret")
114113
));

irods/src/test/java/ch/cyberduck/core/irods/IRODSReadFeatureTest.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@
3838
import ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader;
3939
import ch.cyberduck.core.shared.DefaultUploadFeature;
4040
import ch.cyberduck.core.transfer.TransferStatus;
41-
import ch.cyberduck.test.IntegrationTest;
42-
import ch.cyberduck.test.VaultTest;
41+
import ch.cyberduck.test.TestcontainerTest;
4342

4443
import org.apache.commons.io.IOUtils;
4544
import org.apache.commons.lang3.RandomUtils;
@@ -53,19 +52,18 @@
5352
import java.util.Collections;
5453
import java.util.EnumSet;
5554
import java.util.HashSet;
56-
import java.util.List;
5755
import java.util.UUID;
5856

5957
import static org.junit.Assert.*;
6058

61-
@Category(IntegrationTest.class)
62-
public class IRODSReadFeatureTest extends VaultTest {
59+
@Category(TestcontainerTest.class)
60+
public class IRODSReadFeatureTest extends IRODSDockerComposeManager {
6361

6462
@Test
6563
public void testRead() throws Exception {
6664
final ProtocolFactory factory = new ProtocolFactory(new HashSet<>(Collections.singleton(new IRODSProtocol())));
6765
final Profile profile = new ProfilePlistReader(factory).read(
68-
this.getClass().getResourceAsStream("/iRODS (iPlant Collaborative).cyberduckprofile"));
66+
this.getClass().getResourceAsStream("/iRODS.cyberduckprofile"));
6967
final Host host = new Host(profile, profile.getDefaultHostname(), new Credentials(
7068
PROPERTIES.get("irods.key"), PROPERTIES.get("irods.secret")
7169
));
@@ -101,7 +99,7 @@ public void testRead() throws Exception {
10199
public void testReadNotFound() throws Exception {
102100
final ProtocolFactory factory = new ProtocolFactory(new HashSet<>(Collections.singleton(new IRODSProtocol())));
103101
final Profile profile = new ProfilePlistReader(factory).read(
104-
this.getClass().getResourceAsStream("/iRODS (iPlant Collaborative).cyberduckprofile"));
102+
this.getClass().getResourceAsStream("/iRODS.cyberduckprofile"));
105103
final Host host = new Host(profile, profile.getDefaultHostname(), new Credentials(
106104
PROPERTIES.get("irods.key"), PROPERTIES.get("irods.secret")
107105
));
@@ -121,7 +119,7 @@ public void testReadNotFound() throws Exception {
121119
public void testReadRange() throws Exception {
122120
final ProtocolFactory factory = new ProtocolFactory(new HashSet<>(Collections.singleton(new IRODSProtocol())));
123121
final Profile profile = new ProfilePlistReader(factory).read(
124-
this.getClass().getResourceAsStream("/iRODS (iPlant Collaborative).cyberduckprofile"));
122+
this.getClass().getResourceAsStream("/iRODS.cyberduckprofile"));
125123
final Host host = new Host(profile, profile.getDefaultHostname(), new Credentials(
126124
PROPERTIES.get("irods.key"), PROPERTIES.get("irods.secret")
127125
));

0 commit comments

Comments
 (0)