Skip to content

Commit 7899221

Browse files
committed
Merge pull request #23 from indigo-dc/devel
Add test case to check nested outputs
2 parents d305520 + 502c9a1 commit 7899221

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>es.upv.i3m.grycap</groupId>
55
<artifactId>im-java-api</artifactId>
6-
<version>0.4.1</version>
6+
<version>0.4.2</version>
77
<name>IM Java API</name>
88
<description>Java client for the REST API of the IM</description>
99

src/test/java/es/upv/i3m/grycap/im/InfrastructureManagerTest.java

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,6 @@ public class InfrastructureManagerTest extends ImTestWatcher {
6262

6363
private static final String VM_DEFAULT_ID = "0";
6464

65-
private static final String EXPECTED_INFRASTRUCTURE_OUTPUT_GALAXY_URL_KEY =
66-
"galaxy_url";
67-
private static final String EXPECTED_INFRASTRUCTURE_OUTPUT_GALAXY_URL_VALUE =
68-
"http://10.0.0.1:8080";
69-
7065
private String getInfrastructureId() {
7166
return infrastructureId;
7267
}
@@ -215,10 +210,21 @@ public void testInfrastructureOutputs() throws ImClientException {
215210
String infId = getInfrastructureId();
216211
InfOutputValues result = getIm().getInfrastructureOutputs(infId);
217212
Map<String, Object> outputs = result.getOutputs();
218-
String galaxyUrl =
219-
(String) outputs.get(EXPECTED_INFRASTRUCTURE_OUTPUT_GALAXY_URL_KEY);
220-
Assert.assertEquals(EXPECTED_INFRASTRUCTURE_OUTPUT_GALAXY_URL_VALUE,
221-
galaxyUrl);
213+
String galaxyUrl = (String) outputs.get("galaxy_url");
214+
Assert.assertEquals("http://10.0.0.1:8080", galaxyUrl);
215+
}
216+
217+
@Test
218+
public void testInfrastructureNestedOutputs() throws ImClientException {
219+
String infId = getInfrastructureId();
220+
InfOutputValues result = getIm().getInfrastructureOutputs(infId);
221+
Map<String, Object> outputs = result.getOutputs();
222+
Map<String, Object> credentials =
223+
(Map<String, Object>) outputs.get("cluster_creds");
224+
String user = (String) credentials.get("user");
225+
String token = (String) credentials.get("token");
226+
Assert.assertEquals("username", user);
227+
Assert.assertEquals("password", token);
222228
}
223229

224230
@Test

src/test/resources/tosca/galaxy_tosca.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,6 @@ topology_template:
5757

5858
outputs:
5959
galaxy_url:
60-
value: { concat: [ 'http://', get_attribute: [ galaxy_server, public_address, 0 ], ':8080' ] }
60+
value: { concat: [ 'http://', get_attribute: [ galaxy_server, public_address, 0 ], ':8080' ] }
61+
cluster_creds:
62+
value: { get_attribute: [ galaxy_server, credential, 0 ] }

0 commit comments

Comments
 (0)