Skip to content

Commit 38b1986

Browse files
authored
Merge pull request #31 from indigo-dc/devel
Devel
2 parents 4889e03 + 1d04825 commit 38b1986

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1510
-229
lines changed

pom.xml

Lines changed: 24 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.6</version>
6+
<version>0.4.7</version>
77
<name>IM Java API</name>
88
<description>Java client for the REST API of the IM</description>
99

@@ -21,6 +21,7 @@
2121
<maven-checkstyle-plugin.version>2.17</maven-checkstyle-plugin.version>
2222
<mockserver-netty.version>3.10.4</mockserver-netty.version>
2323
<jacoco-maven-plugin.version>0.7.7.201606060606</jacoco-maven-plugin.version>
24+
<mockito.version>2.0.70-beta</mockito.version>
2425
</properties>
2526

2627
<dependencies>
@@ -66,7 +67,7 @@
6667
<version>${junit.version}</version>
6768
<scope>test</scope>
6869
</dependency>
69-
<!-- mockserver -->
70+
<!-- Mockserver -->
7071
<dependency>
7172
<groupId>org.mock-server</groupId>
7273
<artifactId>mockserver-netty</artifactId>
@@ -193,6 +194,27 @@
193194
</execution>
194195
</executions>
195196
</plugin>
197+
<plugin>
198+
<groupId>org.apache.maven.plugins</groupId>
199+
<artifactId>maven-failsafe-plugin</artifactId>
200+
<version>2.17</version>
201+
<executions>
202+
<execution>
203+
<goals>
204+
<goal>integration-test</goal>
205+
<goal>verify</goal>
206+
</goals>
207+
</execution>
208+
</executions>
209+
</plugin>
210+
<plugin>
211+
<artifactId>maven-surefire-plugin</artifactId>
212+
<configuration>
213+
<classpathDependencyExcludes>
214+
<classpathDependencyExcludes>ch.qos.logback:logback-classic</classpathDependencyExcludes>
215+
</classpathDependencyExcludes>
216+
</configuration>
217+
</plugin>
196218
</plugins>
197219
</build>
198220
</project>

src/main/java/es/upv/i3m/grycap/im/InfrastructureManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ public VirtualMachineInfo alterVm(String infId, String vmId, String radlFile,
405405
* @param bodyContentType
406406
* : type of the content sent in the body of the message
407407
*/
408-
private void failIfToscaContentType(BodyContentType bodyContentType)
408+
private static void failIfToscaContentType(BodyContentType bodyContentType)
409409
throws ImClientException {
410410
if (bodyContentType.equals(BodyContentType.TOSCA)) {
411411
ImJavaApiLogger.severe(InfrastructureManager.class,

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
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+
117
package es.upv.i3m.grycap.im.auth.credentials;
218

319
import java.util.ArrayList;

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
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+
117
package es.upv.i3m.grycap.im.auth.credentials;
218

319
public interface Credentials {

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
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+
117
package es.upv.i3m.grycap.im.auth.credentials;
218

319
public enum ServiceProvider {

src/main/java/es/upv/i3m/grycap/im/auth/credentials/properties/AuthTokenProperty.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
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+
117
package es.upv.i3m.grycap.im.auth.credentials.properties;
218

319
import es.upv.i3m.grycap.im.auth.credentials.Credentials;

src/main/java/es/upv/i3m/grycap/im/auth/credentials/properties/BaseProperties.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
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+
117
package es.upv.i3m.grycap.im.auth.credentials.properties;
218

319
import es.upv.i3m.grycap.im.auth.credentials.Credentials;

src/main/java/es/upv/i3m/grycap/im/auth/credentials/properties/BaseUrlProperty.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
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+
117
package es.upv.i3m.grycap.im.auth.credentials.properties;
218

319
import es.upv.i3m.grycap.im.auth.credentials.Credentials;

src/main/java/es/upv/i3m/grycap/im/auth/credentials/properties/GenericProperty.java

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
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+
117
package es.upv.i3m.grycap.im.auth.credentials.properties;
218

319
import es.upv.i3m.grycap.im.auth.credentials.Credentials;
@@ -7,6 +23,8 @@ public class GenericProperty implements Credentials {
723
private final Credentials credential;
824
private String propertyName;
925
private String propertyValue;
26+
private final String errorMessage;
27+
private static final String NULL_CREDENTIALS = "Empty credentials error.";
1028

1129
/**
1230
* Generic constructor for all the properties that the authorization header
@@ -16,10 +34,8 @@ public GenericProperty(Credentials credential, String propertyName,
1634
String propertyValue, String errorMessage) {
1735
this.credential = credential;
1836
this.propertyName = propertyName;
19-
if (isNullOrEmpty(propertyValue)) {
20-
throw new IllegalArgumentException(errorMessage);
21-
}
2237
this.propertyValue = propertyValue;
38+
this.errorMessage = errorMessage;
2339
}
2440

2541
protected String getPropertyValue() {
@@ -32,11 +48,18 @@ protected Credentials getCredentials() {
3248

3349
@Override
3450
public String serialize() {
35-
StringBuilder credentials = new StringBuilder(credential.serialize());
36-
if (!isNullOrEmpty(propertyValue)) {
37-
credentials.append(" ; " + propertyName + " = ").append(propertyValue);
51+
if (credential != null) {
52+
StringBuilder credentials = new StringBuilder(credential.serialize());
53+
if (!isNullOrEmpty(propertyValue)) {
54+
credentials.append(" ; " + propertyName + " = ").append(propertyValue);
55+
} else {
56+
throw new IllegalArgumentException(errorMessage);
57+
}
58+
return credentials.toString();
59+
} else {
60+
throw new NullPointerException(NULL_CREDENTIALS);
3861
}
39-
return credentials.toString();
62+
4063
}
4164

4265
}

src/main/java/es/upv/i3m/grycap/im/auth/credentials/properties/HostProperty.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
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+
117
package es.upv.i3m.grycap.im.auth.credentials.properties;
218

319
import es.upv.i3m.grycap.im.auth.credentials.Credentials;

0 commit comments

Comments
 (0)