- @Test
- public void testBabelBaseUrl() {
- String url = "http://localhost/";
- Properties props = new Properties();
- props.put(ModelLoaderConfig.PROP_BABEL_BASE_URL, url);
- ModelLoaderConfig config = new ModelLoaderConfig(props, null);
- assertEquals(url, config.getBabelBaseUrl());
- }
-
- @Test
- public void testBabelGenerateArtifactsUrl() {
- String url = "/path/to/the/resource";
- Properties props = new Properties();
- props.put(ModelLoaderConfig.PROP_BABEL_GENERATE_RESOURCE_URL, url);
- ModelLoaderConfig config = new ModelLoaderConfig(props, null);
- assertEquals(url, config.getBabelGenerateArtifactsUrl());
- }
-
- @Test
- public void testMissingAuthenticationProperties() throws IOException {
- Properties props = new Properties();
- props.load(new FileInputStream("src/test/resources/model-loader-empty-auth-password.properties"));
-
- ModelLoaderConfig config = new ModelLoaderConfig(props, null);
- AaiRestClient aaiClient = new AaiRestClient(config);
-
- assertFalse("Empty AAI Password should result in no basic authentication", aaiClient.useBasicAuth());
-
- props.load(new FileInputStream("src/test/resources/model-loader-no-auth-password.properties"));
- config = new ModelLoaderConfig(props, null);
- aaiClient = new AaiRestClient(config);
-
- assertFalse("No AAI Password should result in no basic authentication", aaiClient.useBasicAuth());
- }
-
- @Test
- public void testGetUrls() {
- Properties props = new Properties();
- props.put(ModelLoaderConfig.PROP_AAI_MODEL_RESOURCE_URL, "/aai/v*/service-design-and-creation/models/model/");
- props.put(ModelLoaderConfig.PROP_AAI_NAMED_QUERY_RESOURCE_URL,
- "/aai/v*/service-design-and-creation/named-queries/named-query/");
- ModelLoaderConfig config = new ModelLoaderConfig(props, null);
-
- assertEquals("/aai/v9/service-design-and-creation/models/model/", config.getAaiModelUrl("v9"));
- assertEquals("/aai/v10/service-design-and-creation/named-queries/named-query/",
- config.getAaiNamedQueryUrl("v10"));