Skip to content

Commit 10d547d

Browse files
authored
Merge pull request #69 from indigo-dc/new_ost_params
Add missing OST props
2 parents 343f5e1 + 79d57ac commit 10d547d

17 files changed

+189
-12
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
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.14</version>
6+
<version>0.4.15</version>
77
<name>IM Java API</name>
88
<description>Java client for the REST API of the IM</description>
99

@@ -12,7 +12,7 @@
1212
<maven-compiler-plugin.version>3.5.1</maven-compiler-plugin.version>
1313
<maven-assembly-plugin.version>2.6</maven-assembly-plugin.version>
1414
<jersey-client.version>2.22.2</jersey-client.version>
15-
<jackson.version>2.10.2</jackson.version>
15+
<jackson.version>2.12.1</jackson.version>
1616
<apache-commons.version>3.4</apache-commons.version>
1717
<junit.version>4.13.1</junit.version>
1818
<log4j.version>1.2.17</log4j.version>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/**
2+
* Copyright (C) GRyCAP - I3M - UPV
3+
*
4+
* <p>Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* <p>http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* <p>Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package es.upv.i3m.grycap.im.auth.credentials.properties;
18+
19+
import es.upv.i3m.grycap.im.auth.credentials.Credentials;
20+
21+
public class ImageUrlProperty extends GenericProperty {
22+
23+
private static final String PROPERTY_NAME = "image_url";
24+
private static final String ERROR_MESSAGE = "Image url must not be blank";
25+
26+
public ImageUrlProperty(Credentials credential, String imageUrl) {
27+
super(credential, PROPERTY_NAME, imageUrl, ERROR_MESSAGE);
28+
}
29+
30+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/**
2+
* Copyright (C) GRyCAP - I3M - UPV
3+
*
4+
* <p>Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* <p>http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* <p>Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package es.upv.i3m.grycap.im.auth.credentials.properties;
18+
19+
import es.upv.i3m.grycap.im.auth.credentials.Credentials;
20+
21+
public class MicroversionProperty extends GenericProperty {
22+
23+
private static final String PROPERTY_NAME = "microversion";
24+
private static final String ERROR_MESSAGE = "Microversion must not be blank";
25+
26+
public MicroversionProperty(Credentials credential, String microversion) {
27+
super(credential, PROPERTY_NAME, microversion, ERROR_MESSAGE);
28+
}
29+
30+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/**
2+
* Copyright (C) GRyCAP - I3M - UPV
3+
*
4+
* <p>Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* <p>http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* <p>Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package es.upv.i3m.grycap.im.auth.credentials.properties;
18+
19+
import es.upv.i3m.grycap.im.auth.credentials.Credentials;
20+
21+
public class NetworkUrlProperty extends GenericProperty {
22+
23+
private static final String PROPERTY_NAME = "network_url";
24+
private static final String ERROR_MESSAGE = "Network url must not be blank";
25+
26+
public NetworkUrlProperty(Credentials credential, String networkUrl) {
27+
super(credential, PROPERTY_NAME, networkUrl, ERROR_MESSAGE);
28+
}
29+
30+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/**
2+
* Copyright (C) GRyCAP - I3M - UPV
3+
*
4+
* <p>Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* <p>http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* <p>Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package es.upv.i3m.grycap.im.auth.credentials.properties;
18+
19+
import es.upv.i3m.grycap.im.auth.credentials.Credentials;
20+
21+
public class VolumeUrlProperty extends GenericProperty {
22+
23+
private static final String PROPERTY_NAME = "volume_url";
24+
private static final String ERROR_MESSAGE = "Volume url must not be blank";
25+
26+
public VolumeUrlProperty(Credentials credential, String volumeUrl) {
27+
super(credential, PROPERTY_NAME, volumeUrl, ERROR_MESSAGE);
28+
}
29+
30+
}

src/main/java/es/upv/i3m/grycap/im/auth/credentials/providers/OpenStackCredentials.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,14 @@
2020
import es.upv.i3m.grycap.im.auth.credentials.properties.AuthTokenProperty;
2121
import es.upv.i3m.grycap.im.auth.credentials.properties.BaseUrlProperty;
2222
import es.upv.i3m.grycap.im.auth.credentials.properties.DomainProperty;
23+
import es.upv.i3m.grycap.im.auth.credentials.properties.ImageUrlProperty;
24+
import es.upv.i3m.grycap.im.auth.credentials.properties.MicroversionProperty;
25+
import es.upv.i3m.grycap.im.auth.credentials.properties.NetworkUrlProperty;
2326
import es.upv.i3m.grycap.im.auth.credentials.properties.OpenStackAuthVersionProperty;
2427
import es.upv.i3m.grycap.im.auth.credentials.properties.ServiceNameProperty;
2528
import es.upv.i3m.grycap.im.auth.credentials.properties.ServiceRegionProperty;
2629
import es.upv.i3m.grycap.im.auth.credentials.properties.TenantProperty;
30+
import es.upv.i3m.grycap.im.auth.credentials.properties.VolumeUrlProperty;
2731

2832
public class OpenStackCredentials
2933
extends GenericCredentials<OpenStackCredentials> {
@@ -74,6 +78,26 @@ public OpenStackCredentials withDomain(String domain) {
7478
return this;
7579
}
7680

81+
public OpenStackCredentials withMicroversion(String microversion) {
82+
setCredentials(new MicroversionProperty(getCredentials(), microversion));
83+
return this;
84+
}
85+
86+
public OpenStackCredentials withImageUrl(String imageUrl) {
87+
setCredentials(new ImageUrlProperty(getCredentials(), imageUrl));
88+
return this;
89+
}
90+
91+
public OpenStackCredentials withNetworkUrl(String networkUrl) {
92+
setCredentials(new NetworkUrlProperty(getCredentials(), networkUrl));
93+
return this;
94+
}
95+
96+
public OpenStackCredentials withVolumeUrl(String volumeUrl) {
97+
setCredentials(new VolumeUrlProperty(getCredentials(), volumeUrl));
98+
return this;
99+
}
100+
77101
/**
78102
* Sets the authorization version specific for OpenStack.
79103
*/

src/test/java/es/upv/i3m/grycap/im/auth/credentials/AuthorizationHeaderTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public void testAuthorizationHeader() throws ImClientException {
4949
getAuthorizationHeader().addCredential(cred);
5050
cred = VmrcCredentials.buildCredentials().withUsername("demo")
5151
.withPassword("demo")
52-
.withHost("http://servproject.i3m.upv.es:8080/vmrc/vmrc");
52+
.withHost("http://appsgrycap.i3m.upv.es:32080/vmrc/vmrc");
5353
getAuthorizationHeader().addCredential(cred);
5454
cred = DummyCredential.buildCredentials();
5555
getAuthorizationHeader().addCredential(cred);

src/test/java/es/upv/i3m/grycap/im/auth/credentials/PropertiesTest.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
import es.upv.i3m.grycap.im.auth.credentials.properties.DomainProperty;
2323
import es.upv.i3m.grycap.im.auth.credentials.properties.GenericProperty;
2424
import es.upv.i3m.grycap.im.auth.credentials.properties.HostProperty;
25+
import es.upv.i3m.grycap.im.auth.credentials.properties.ImageUrlProperty;
26+
import es.upv.i3m.grycap.im.auth.credentials.properties.MicroversionProperty;
27+
import es.upv.i3m.grycap.im.auth.credentials.properties.NetworkUrlProperty;
2528
import es.upv.i3m.grycap.im.auth.credentials.properties.OpenStackAuthVersionProperty;
2629
import es.upv.i3m.grycap.im.auth.credentials.properties.PasswordProperty;
2730
import es.upv.i3m.grycap.im.auth.credentials.properties.PrivateKeyProperty;
@@ -33,8 +36,10 @@
3336
import es.upv.i3m.grycap.im.auth.credentials.properties.TenantProperty;
3437
import es.upv.i3m.grycap.im.auth.credentials.properties.TokenProperty;
3538
import es.upv.i3m.grycap.im.auth.credentials.properties.UserNameProperty;
39+
import es.upv.i3m.grycap.im.auth.credentials.properties.VolumeUrlProperty;
3640
import es.upv.i3m.grycap.im.auth.credentials.providers.OpenStackAuthVersion;
3741

42+
3843
import org.junit.Assert;
3944
import org.junit.Test;
4045

@@ -231,4 +236,32 @@ public void testSubscriptionIdProperty() {
231236
p.serialize());
232237
}
233238

239+
@Test
240+
public void testImageUrlProperty() {
241+
ImageUrlProperty p = new ImageUrlProperty(BP, PROPERTY_VALUE);
242+
Assert.assertEquals(BP_EXPECTED_RESULT + " ; image_url = " + PROPERTY_VALUE,
243+
p.serialize());
244+
}
245+
246+
@Test
247+
public void testVolumeUrlProperty() {
248+
VolumeUrlProperty p = new VolumeUrlProperty(BP, PROPERTY_VALUE);
249+
Assert.assertEquals(BP_EXPECTED_RESULT + " ; volume_url = " + PROPERTY_VALUE,
250+
p.serialize());
251+
}
252+
253+
@Test
254+
public void testNetworkUrlProperty() {
255+
NetworkUrlProperty p = new NetworkUrlProperty(BP, PROPERTY_VALUE);
256+
Assert.assertEquals(BP_EXPECTED_RESULT + " ; network_url = " + PROPERTY_VALUE,
257+
p.serialize());
258+
}
259+
260+
@Test
261+
public void testMicroversioProperty() {
262+
MicroversionProperty p = new MicroversionProperty(BP, PROPERTY_VALUE);
263+
Assert.assertEquals(BP_EXPECTED_RESULT + " ; microversion = " + PROPERTY_VALUE,
264+
p.serialize());
265+
}
266+
234267
}

src/test/resources/auth.dat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
type = InfrastructureManager; username = imuser01; password = invitado
22
id = dummy; type = Dummy
3-
type = VMRC; host = http://servproject.i3m.upv.es:8080/vmrc/vmrc; username = demo; password = demo
3+
type = VMRC; host = http://appsgrycap.i3m.upv.es:32080/vmrc/vmrc; username = demo; password = demo
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
type = InfrastructureManager; username = imuser01; password = invitado\nid = dummy; type = Dummy;\ntype = VMRC; host = http://servproject.i3m.upv.es:8080/vmrc/vmrc; username = demo; password = demo;
1+
type = InfrastructureManager; username = imuser01; password = invitado\nid = dummy; type = Dummy;\ntype = VMRC; host = http://appsgrycap.i3m.upv.es:32080/vmrc/vmrc; username = demo; password = demo;

0 commit comments

Comments
 (0)