Skip to content

Commit

Permalink
Merge pull request #69 from indigo-dc/new_ost_params
Browse files Browse the repository at this point in the history
Add missing OST props
  • Loading branch information
micafer authored Jan 27, 2022
2 parents 343f5e1 + 79d57ac commit 10d547d
Show file tree
Hide file tree
Showing 17 changed files with 189 additions and 12 deletions.
4 changes: 2 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.14</version>
<version>0.4.15</version>
<name>IM Java API</name>
<description>Java client for the REST API of the IM</description>

Expand All @@ -12,7 +12,7 @@
<maven-compiler-plugin.version>3.5.1</maven-compiler-plugin.version>
<maven-assembly-plugin.version>2.6</maven-assembly-plugin.version>
<jersey-client.version>2.22.2</jersey-client.version>
<jackson.version>2.10.2</jackson.version>
<jackson.version>2.12.1</jackson.version>
<apache-commons.version>3.4</apache-commons.version>
<junit.version>4.13.1</junit.version>
<log4j.version>1.2.17</log4j.version>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +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 ImageUrlProperty extends GenericProperty {

private static final String PROPERTY_NAME = "image_url";
private static final String ERROR_MESSAGE = "Image url must not be blank";

public ImageUrlProperty(Credentials credential, String imageUrl) {
super(credential, PROPERTY_NAME, imageUrl, ERROR_MESSAGE);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +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 MicroversionProperty extends GenericProperty {

private static final String PROPERTY_NAME = "microversion";
private static final String ERROR_MESSAGE = "Microversion must not be blank";

public MicroversionProperty(Credentials credential, String microversion) {
super(credential, PROPERTY_NAME, microversion, ERROR_MESSAGE);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +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 NetworkUrlProperty extends GenericProperty {

private static final String PROPERTY_NAME = "network_url";
private static final String ERROR_MESSAGE = "Network url must not be blank";

public NetworkUrlProperty(Credentials credential, String networkUrl) {
super(credential, PROPERTY_NAME, networkUrl, ERROR_MESSAGE);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +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 VolumeUrlProperty extends GenericProperty {

private static final String PROPERTY_NAME = "volume_url";
private static final String ERROR_MESSAGE = "Volume url must not be blank";

public VolumeUrlProperty(Credentials credential, String volumeUrl) {
super(credential, PROPERTY_NAME, volumeUrl, ERROR_MESSAGE);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@
import es.upv.i3m.grycap.im.auth.credentials.properties.AuthTokenProperty;
import es.upv.i3m.grycap.im.auth.credentials.properties.BaseUrlProperty;
import es.upv.i3m.grycap.im.auth.credentials.properties.DomainProperty;
import es.upv.i3m.grycap.im.auth.credentials.properties.ImageUrlProperty;
import es.upv.i3m.grycap.im.auth.credentials.properties.MicroversionProperty;
import es.upv.i3m.grycap.im.auth.credentials.properties.NetworkUrlProperty;
import es.upv.i3m.grycap.im.auth.credentials.properties.OpenStackAuthVersionProperty;
import es.upv.i3m.grycap.im.auth.credentials.properties.ServiceNameProperty;
import es.upv.i3m.grycap.im.auth.credentials.properties.ServiceRegionProperty;
import es.upv.i3m.grycap.im.auth.credentials.properties.TenantProperty;
import es.upv.i3m.grycap.im.auth.credentials.properties.VolumeUrlProperty;

public class OpenStackCredentials
extends GenericCredentials<OpenStackCredentials> {
Expand Down Expand Up @@ -74,6 +78,26 @@ public OpenStackCredentials withDomain(String domain) {
return this;
}

public OpenStackCredentials withMicroversion(String microversion) {
setCredentials(new MicroversionProperty(getCredentials(), microversion));
return this;
}

public OpenStackCredentials withImageUrl(String imageUrl) {
setCredentials(new ImageUrlProperty(getCredentials(), imageUrl));
return this;
}

public OpenStackCredentials withNetworkUrl(String networkUrl) {
setCredentials(new NetworkUrlProperty(getCredentials(), networkUrl));
return this;
}

public OpenStackCredentials withVolumeUrl(String volumeUrl) {
setCredentials(new VolumeUrlProperty(getCredentials(), volumeUrl));
return this;
}

/**
* Sets the authorization version specific for OpenStack.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void testAuthorizationHeader() throws ImClientException {
getAuthorizationHeader().addCredential(cred);
cred = VmrcCredentials.buildCredentials().withUsername("demo")
.withPassword("demo")
.withHost("http://servproject.i3m.upv.es:8080/vmrc/vmrc");
.withHost("http://appsgrycap.i3m.upv.es:32080/vmrc/vmrc");
getAuthorizationHeader().addCredential(cred);
cred = DummyCredential.buildCredentials();
getAuthorizationHeader().addCredential(cred);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
import es.upv.i3m.grycap.im.auth.credentials.properties.DomainProperty;
import es.upv.i3m.grycap.im.auth.credentials.properties.GenericProperty;
import es.upv.i3m.grycap.im.auth.credentials.properties.HostProperty;
import es.upv.i3m.grycap.im.auth.credentials.properties.ImageUrlProperty;
import es.upv.i3m.grycap.im.auth.credentials.properties.MicroversionProperty;
import es.upv.i3m.grycap.im.auth.credentials.properties.NetworkUrlProperty;
import es.upv.i3m.grycap.im.auth.credentials.properties.OpenStackAuthVersionProperty;
import es.upv.i3m.grycap.im.auth.credentials.properties.PasswordProperty;
import es.upv.i3m.grycap.im.auth.credentials.properties.PrivateKeyProperty;
Expand All @@ -33,8 +36,10 @@
import es.upv.i3m.grycap.im.auth.credentials.properties.TenantProperty;
import es.upv.i3m.grycap.im.auth.credentials.properties.TokenProperty;
import es.upv.i3m.grycap.im.auth.credentials.properties.UserNameProperty;
import es.upv.i3m.grycap.im.auth.credentials.properties.VolumeUrlProperty;
import es.upv.i3m.grycap.im.auth.credentials.providers.OpenStackAuthVersion;


import org.junit.Assert;
import org.junit.Test;

Expand Down Expand Up @@ -231,4 +236,32 @@ public void testSubscriptionIdProperty() {
p.serialize());
}

@Test
public void testImageUrlProperty() {
ImageUrlProperty p = new ImageUrlProperty(BP, PROPERTY_VALUE);
Assert.assertEquals(BP_EXPECTED_RESULT + " ; image_url = " + PROPERTY_VALUE,
p.serialize());
}

@Test
public void testVolumeUrlProperty() {
VolumeUrlProperty p = new VolumeUrlProperty(BP, PROPERTY_VALUE);
Assert.assertEquals(BP_EXPECTED_RESULT + " ; volume_url = " + PROPERTY_VALUE,
p.serialize());
}

@Test
public void testNetworkUrlProperty() {
NetworkUrlProperty p = new NetworkUrlProperty(BP, PROPERTY_VALUE);
Assert.assertEquals(BP_EXPECTED_RESULT + " ; network_url = " + PROPERTY_VALUE,
p.serialize());
}

@Test
public void testMicroversioProperty() {
MicroversionProperty p = new MicroversionProperty(BP, PROPERTY_VALUE);
Assert.assertEquals(BP_EXPECTED_RESULT + " ; microversion = " + PROPERTY_VALUE,
p.serialize());
}

}
2 changes: 1 addition & 1 deletion src/test/resources/auth.dat
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
type = InfrastructureManager; username = imuser01; password = invitado
id = dummy; type = Dummy
type = VMRC; host = http://servproject.i3m.upv.es:8080/vmrc/vmrc; username = demo; password = demo
type = VMRC; host = http://appsgrycap.i3m.upv.es:32080/vmrc/vmrc; username = demo; password = demo
Original file line number Diff line number Diff line change
@@ -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;
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;
Original file line number Diff line number Diff line change
@@ -1 +1 @@
type = InfrastructureManager; username = imuser01; password = invitado\nid = dummy; type = Dummy; proxy = 12345678921 4242434 234 234\\n9876543212131 2 32423\\n1926838916 23423\ntype = VMRC; host = http://servproject.i3m.upv.es:8080/vmrc/vmrc; username = demo; password = demo;
type = InfrastructureManager; username = imuser01; password = invitado\nid = dummy; type = Dummy; proxy = 12345678921 4242434 234 234\\n9876543212131 2 32423\\n1926838916 23423\ntype = VMRC; host = http://appsgrycap.i3m.upv.es:32080/vmrc/vmrc; username = demo; password = demo;
Original file line number Diff line number Diff line change
@@ -1 +1 @@
type = InfrastructureManager; proxy = 12345678921 4242434 234 234\\n9876543212131 2 32423\\n1926838916 23423; username = imuser01; password = invitado\nid = dummy; type = Dummy; proxy = 123456789\nproxy = 123456789; type = VMRC; host = http://servproject.i3m.upv.es:8080/vmrc/vmrc; username = demo; password = demo;
type = InfrastructureManager; proxy = 12345678921 4242434 234 234\\n9876543212131 2 32423\\n1926838916 23423; username = imuser01; password = invitado\nid = dummy; type = Dummy; proxy = 123456789\nproxy = 123456789; type = VMRC; host = http://appsgrycap.i3m.upv.es:32080/vmrc/vmrc; username = demo; password = demo;
2 changes: 1 addition & 1 deletion src/test/resources/files/auth_no_internal_path.dat
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
type = InfrastructureManager; username = imuser01; password = invitado
id = dummy; type = Dummy;
type = VMRC; host = http://servproject.i3m.upv.es:8080/vmrc/vmrc; username = demo; password = demo;
type = VMRC; host = http://appsgrycap.i3m.upv.es:32080/vmrc/vmrc; username = demo; password = demo;
2 changes: 1 addition & 1 deletion src/test/resources/files/auth_one_internal_path.dat
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
type = InfrastructureManager; username = imuser01; password = invitado
id = dummy; type = Dummy; proxy = file(./src/test/resources/files/nested_file_path_content_several_lines)
type = VMRC; host = http://servproject.i3m.upv.es:8080/vmrc/vmrc; username = demo; password = demo;
type = VMRC; host = http://appsgrycap.i3m.upv.es:32080/vmrc/vmrc; username = demo; password = demo;
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
type = InfrastructureManager; proxy = file(./src/test/resources/files/nested_file_path_content_several_lines); username = imuser01; password = invitado
id = dummy; type = Dummy; proxy = file(./src/test/resources/files/nested_file_path_content_one_line)
proxy = file(./src/test/resources/files/nested_file_path_content_one_line); type = VMRC; host = http://servproject.i3m.upv.es:8080/vmrc/vmrc; username = demo; password = demo;
proxy = file(./src/test/resources/files/nested_file_path_content_one_line); type = VMRC; host = http://appsgrycap.i3m.upv.es:32080/vmrc/vmrc; username = demo; password = demo;
2 changes: 1 addition & 1 deletion src/test/resources/files/auth_two_internal_path.dat
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
type = InfrastructureManager; username = imuser01; password = invitado
id = dummy; type = Dummy; proxy = file(./src/test/resources/files/nested_file_path_content_empty)
type = VMRC; host = http://servproject.i3m.upv.es:8080/vmrc/vmrc; username = demo; password = demo; proxy = file(./src/test/resources/files/nested_file_path_content_several_lines)
type = VMRC; host = http://appsgrycap.i3m.upv.es:32080/vmrc/vmrc; username = demo; password = demo; proxy = file(./src/test/resources/files/nested_file_path_content_several_lines)
2 changes: 1 addition & 1 deletion src/test/resources/files/double_escaped_lines_result
Original file line number Diff line number Diff line change
@@ -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;
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 comments on commit 10d547d

Please sign in to comment.