* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.aai.parsers.uri;
+import static org.junit.Assert.assertEquals;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+
+import javax.annotation.PostConstruct;
+import javax.ws.rs.core.UriBuilder;
+import javax.xml.bind.JAXBException;
+
import org.junit.Test;
import org.onap.aai.AAISetup;
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.restcore.HttpMethod;
import org.onap.aai.setup.SchemaVersion;
-import javax.annotation.PostConstruct;
-import javax.ws.rs.core.UriBuilder;
-import javax.xml.bind.JAXBException;
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-
-import static org.junit.Assert.assertEquals;
-
public class URIToExtensionInformationTest extends AAISetup {
-
- private Loader specificLoader ;
-
+ private Loader specificLoader;
+
/**
* Vservers V 7.
*
* @throws IllegalArgumentException the illegal argument exception
* @throws UnsupportedEncodingException the unsupported encoding exception
*/
-
+
@PostConstruct
- public void createLoader(){
+ public void createLoader() {
specificLoader = loaderFactory.createLoaderForVersion(ModelType.MOXY, new SchemaVersion("v10"));
}
-
+
@Test
- public void vserversV8() throws JAXBException, AAIException, IllegalArgumentException, UnsupportedEncodingException {
- URI uri = UriBuilder.fromPath("/aai/" + specificLoader.getVersion() + "/cloud-infrastructure/cloud-regions/cloud-region/testOwner1/testRegion1/tenants/tenant/key1/vservers/vserver/key2").build();
+ public void vserversV8()
+ throws JAXBException, AAIException, IllegalArgumentException, UnsupportedEncodingException {
+ URI uri = UriBuilder.fromPath("/aai/" + specificLoader.getVersion()
+ + "/cloud-infrastructure/cloud-regions/cloud-region/testOwner1/testRegion1/tenants/tenant/key1/vservers/vserver/key2")
+ .build();
URIToExtensionInformation parse = new URIToExtensionInformation(specificLoader, uri);
-
+
String namespace = "cloudInfrastructure";
- String preMethodName = "DynamicAddCloudInfrastructureCloudRegionsCloudRegionTenantsTenantVserversVserverPreProc";
- String postMethodName = "DynamicAddCloudInfrastructureCloudRegionsCloudRegionTenantsTenantVserversVserverPostProc";
+ String preMethodName =
+ "DynamicAddCloudInfrastructureCloudRegionsCloudRegionTenantsTenantVserversVserverPreProc";
+ String postMethodName =
+ "DynamicAddCloudInfrastructureCloudRegionsCloudRegionTenantsTenantVserversVserverPostProc";
String topLevel = "CloudRegion";
testSpec(parse, HttpMethod.PUT, namespace, preMethodName, postMethodName, topLevel);
* @param postMethodName the post method name
* @param topLevel the top level
*/
- private void testSpec(URIToExtensionInformation info, HttpMethod httpMethod, String namespace, String preMethodName, String postMethodName, String topLevel) {
-
+ private void testSpec(URIToExtensionInformation info, HttpMethod httpMethod, String namespace, String preMethodName,
+ String postMethodName, String topLevel) {
String namespaceResult = info.getNamespace();
String methodNameResult = info.getMethodName(httpMethod, true);
-
+
assertEquals("namespace", namespace, namespaceResult);
assertEquals("preprocess method name", preMethodName, methodNameResult);
methodNameResult = info.getMethodName(httpMethod, false);
assertEquals("postprocess method name", postMethodName, methodNameResult);
String topLevelResult = info.getTopObject();
-
+
assertEquals("topLevel", topLevel, topLevelResult);
}
-
-
+
}