Skip to content

Commit

Permalink
Merge pull request #31 from indigo-dc/devel
Browse files Browse the repository at this point in the history
Devel
  • Loading branch information
Alfonso Pérez authored Jun 21, 2016
2 parents 4889e03 + 1d04825 commit 38b1986
Show file tree
Hide file tree
Showing 55 changed files with 1,510 additions and 229 deletions.
26 changes: 24 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>es.upv.i3m.grycap</groupId>
<artifactId>im-java-api</artifactId>
<version>0.4.6</version>
<version>0.4.7</version>
<name>IM Java API</name>
<description>Java client for the REST API of the IM</description>

Expand All @@ -21,6 +21,7 @@
<maven-checkstyle-plugin.version>2.17</maven-checkstyle-plugin.version>
<mockserver-netty.version>3.10.4</mockserver-netty.version>
<jacoco-maven-plugin.version>0.7.7.201606060606</jacoco-maven-plugin.version>
<mockito.version>2.0.70-beta</mockito.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -66,7 +67,7 @@
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<!-- mockserver -->
<!-- Mockserver -->
<dependency>
<groupId>org.mock-server</groupId>
<artifactId>mockserver-netty</artifactId>
Expand Down Expand Up @@ -193,6 +194,27 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.17</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<classpathDependencyExcludes>
<classpathDependencyExcludes>ch.qos.logback:logback-classic</classpathDependencyExcludes>
</classpathDependencyExcludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ public VirtualMachineInfo alterVm(String infId, String vmId, String radlFile,
* @param bodyContentType
* : type of the content sent in the body of the message
*/
private void failIfToscaContentType(BodyContentType bodyContentType)
private static void failIfToscaContentType(BodyContentType bodyContentType)
throws ImClientException {
if (bodyContentType.equals(BodyContentType.TOSCA)) {
ImJavaApiLogger.severe(InfrastructureManager.class,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/**
* Copyright (C) GRyCAP - I3M - UPV
*
* <p>Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* <p>http://www.apache.org/licenses/LICENSE-2.0
*
* <p>Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package es.upv.i3m.grycap.im.auth.credentials;

import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/**
* Copyright (C) GRyCAP - I3M - UPV
*
* <p>Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* <p>http://www.apache.org/licenses/LICENSE-2.0
*
* <p>Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package es.upv.i3m.grycap.im.auth.credentials;

public interface Credentials {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/**
* Copyright (C) GRyCAP - I3M - UPV
*
* <p>Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* <p>http://www.apache.org/licenses/LICENSE-2.0
*
* <p>Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package es.upv.i3m.grycap.im.auth.credentials;

public enum ServiceProvider {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/**
* Copyright (C) GRyCAP - I3M - UPV
*
* <p>Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* <p>http://www.apache.org/licenses/LICENSE-2.0
*
* <p>Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package es.upv.i3m.grycap.im.auth.credentials.properties;

import es.upv.i3m.grycap.im.auth.credentials.Credentials;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/**
* Copyright (C) GRyCAP - I3M - UPV
*
* <p>Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* <p>http://www.apache.org/licenses/LICENSE-2.0
*
* <p>Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package es.upv.i3m.grycap.im.auth.credentials.properties;

import es.upv.i3m.grycap.im.auth.credentials.Credentials;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/**
* Copyright (C) GRyCAP - I3M - UPV
*
* <p>Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* <p>http://www.apache.org/licenses/LICENSE-2.0
*
* <p>Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package es.upv.i3m.grycap.im.auth.credentials.properties;

import es.upv.i3m.grycap.im.auth.credentials.Credentials;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/**
* Copyright (C) GRyCAP - I3M - UPV
*
* <p>Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* <p>http://www.apache.org/licenses/LICENSE-2.0
*
* <p>Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package es.upv.i3m.grycap.im.auth.credentials.properties;

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

/**
* Generic constructor for all the properties that the authorization header
Expand All @@ -16,10 +34,8 @@ public GenericProperty(Credentials credential, String propertyName,
String propertyValue, String errorMessage) {
this.credential = credential;
this.propertyName = propertyName;
if (isNullOrEmpty(propertyValue)) {
throw new IllegalArgumentException(errorMessage);
}
this.propertyValue = propertyValue;
this.errorMessage = errorMessage;
}

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

@Override
public String serialize() {
StringBuilder credentials = new StringBuilder(credential.serialize());
if (!isNullOrEmpty(propertyValue)) {
credentials.append(" ; " + propertyName + " = ").append(propertyValue);
if (credential != null) {
StringBuilder credentials = new StringBuilder(credential.serialize());
if (!isNullOrEmpty(propertyValue)) {
credentials.append(" ; " + propertyName + " = ").append(propertyValue);
} else {
throw new IllegalArgumentException(errorMessage);
}
return credentials.toString();
} else {
throw new NullPointerException(NULL_CREDENTIALS);
}
return credentials.toString();

}

}
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/**
* Copyright (C) GRyCAP - I3M - UPV
*
* <p>Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* <p>http://www.apache.org/licenses/LICENSE-2.0
*
* <p>Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package es.upv.i3m.grycap.im.auth.credentials.properties;

import es.upv.i3m.grycap.im.auth.credentials.Credentials;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/**
* Copyright (C) GRyCAP - I3M - UPV
*
* <p>Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* <p>http://www.apache.org/licenses/LICENSE-2.0
*
* <p>Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package es.upv.i3m.grycap.im.auth.credentials.properties;

import es.upv.i3m.grycap.im.auth.credentials.Credentials;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/**
* Copyright (C) GRyCAP - I3M - UPV
*
* <p>Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* <p>http://www.apache.org/licenses/LICENSE-2.0
*
* <p>Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package es.upv.i3m.grycap.im.auth.credentials.properties;

import es.upv.i3m.grycap.im.auth.credentials.Credentials;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
/**
* Copyright (C) GRyCAP - I3M - UPV
*
* <p>Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* <p>http://www.apache.org/licenses/LICENSE-2.0
*
* <p>Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package es.upv.i3m.grycap.im.auth.credentials.properties;

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

public class PrivateKeyProperty extends GenericProperty {

private static final String PROPERTY_NAME = "public_key";
private static final String ERROR_MESSAGE = "Public key must not be blank";
private static final String PROPERTY_NAME = "private_key";
private static final String ERROR_MESSAGE = "Private key must not be blank";

public PrivateKeyProperty(Credentials credential, String publicKey) {
super(credential, PROPERTY_NAME, publicKey, ERROR_MESSAGE);
public PrivateKeyProperty(Credentials credential, String privateKey) {
super(credential, PROPERTY_NAME, privateKey, ERROR_MESSAGE);
}

}
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/**
* Copyright (C) GRyCAP - I3M - UPV
*
* <p>Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* <p>http://www.apache.org/licenses/LICENSE-2.0
*
* <p>Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package es.upv.i3m.grycap.im.auth.credentials.properties;

import es.upv.i3m.grycap.im.auth.credentials.Credentials;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/**
* Copyright (C) GRyCAP - I3M - UPV
*
* <p>Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* <p>http://www.apache.org/licenses/LICENSE-2.0
*
* <p>Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package es.upv.i3m.grycap.im.auth.credentials.properties;

import es.upv.i3m.grycap.im.auth.credentials.Credentials;
Expand Down
Loading

0 comments on commit 38b1986

Please sign in to comment.