Skip to content

Commit 918a24d

Browse files
committed
Test Uploading Directories
Previously, all testing of application upload was done with archives. This change adds tests at both the client and operations layer to ensure that directory upload works as well.
1 parent 52cd84e commit 918a24d

File tree

4 files changed

+44
-0
lines changed

4 files changed

+44
-0
lines changed

integration-test/src/test/java/org/cloudfoundry/client/v2/ApplicationsTest.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,30 @@ public void uploadAndDownloadAsyncFalse() throws TimeoutException, InterruptedEx
827827
.verify(Duration.ofMinutes(5));
828828
}
829829

830+
@Test
831+
public void uploadDirectory() {
832+
String applicationName = this.nameFactory.getApplicationName();
833+
834+
this.spaceId
835+
.then(spaceId -> createApplicationId(this.cloudFoundryClient, spaceId, applicationName))
836+
.then(applicationId -> {
837+
try {
838+
return this.cloudFoundryClient.applicationsV2()
839+
.upload(UploadApplicationRequest.builder()
840+
.application(new ClassPathResource("test-application").getFile().toPath())
841+
.async(true)
842+
.applicationId(applicationId)
843+
.build())
844+
.then(job -> JobUtils.waitForCompletion(this.cloudFoundryClient, Duration.ofMinutes(5), job));
845+
} catch (IOException e) {
846+
throw new RuntimeException(e);
847+
}
848+
})
849+
.as(StepVerifier::create)
850+
.expectComplete()
851+
.verify(Duration.ofMinutes(5));
852+
}
853+
830854
private static Consumer<Tuple2<String, AbstractApplicationResource>> applicationIdAndNameEquality(String name) {
831855
Assert.notNull(name, "name must not be null");
832856

integration-test/src/test/java/org/cloudfoundry/operations/ApplicationsTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,16 @@ public void getStopped() throws TimeoutException, InterruptedException, IOExcept
168168
.verify(Duration.ofMinutes(5));
169169
}
170170

171+
@Test
172+
public void pushDirectory() throws TimeoutException, InterruptedException, IOException {
173+
String applicationName = this.nameFactory.getApplicationName();
174+
175+
createApplication(this.cloudFoundryOperations, new ClassPathResource("test-application").getFile().toPath(), applicationName, false)
176+
.as(StepVerifier::create)
177+
.expectComplete()
178+
.verify(Duration.ofMinutes(5));
179+
}
180+
171181
@Test
172182
public void pushDomainNotFound() throws TimeoutException, InterruptedException, IOException {
173183
String applicationName = this.nameFactory.getApplicationName();

integration-test/src/test/resources/test-application/Staticfile

Whitespace-only changes.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
5+
<title>Hello Web!</title>
6+
</head>
7+
<body>
8+
<p>Hello Web!</p>
9+
</body>
10+
</html>

0 commit comments

Comments
 (0)