Adding basic auth support to sdc sim 55/92455/2
authorwaqas.ikram <waqas.ikram@est.tech>
Thu, 1 Aug 2019 11:51:24 +0000 (11:51 +0000)
committerWaqas Ikram <waqas.ikram@est.tech>
Thu, 1 Aug 2019 11:52:49 +0000 (11:52 +0000)
Change-Id: Ifa01f084150ec0f67e30e18a4f74c35633a4c0a7
Issue-ID: SO-1949
Signed-off-by: waqas.ikram <waqas.ikram@est.tech>
12 files changed:
plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/controller/ProjectControllerTest.java
plans/so/integration-etsi-testing/so-simulators/package/docker/pom.xml
plans/so/integration-etsi-testing/so-simulators/sdc-simulator/pom.xml
plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdc/simulator/configration/WebSecurityConfigImpl.java [new file with mode: 0644]
plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdc/simulator/controller/CatalogController.java [moved from plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdc/simulator/SdcSimulatorController.java with 79% similarity]
plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdc/simulator/controller/SdcSimulatorController.java [new file with mode: 0644]
plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdc/simulator/providers/ResourceProviderImpl.java
plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdc/simulator/utils/Constants.java [moved from plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdc/simulator/utils/Constant.java with 88% similarity]
plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/resources/application.yaml
plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/test/java/org/onap/so/sdc/simulator/controller/CatalogControllerTest.java [moved from plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/test/java/org/onap/so/sdc/simulator/SdcSimulatorControllerTest.java with 67% similarity]
plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/test/java/org/onap/so/sdc/simulator/controller/SdcSimulatorControllerTest.java [new file with mode: 0644]
plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/test/java/org/onap/so/sdc/simulator/providers/ResourceProviderImplTest.java

index dbe70ce..ba6ad97 100644 (file)
@@ -144,8 +144,6 @@ public class ProjectControllerTest {
         assertNotNull(result.getValues());
         assertFalse(result.getValues().isEmpty());
         assertEquals(1, result.getValues().get(0).get(Constants.PROJECT));
-
-
     }
 
     private <T> ResponseEntity<T> invokeHttpGet(final String url, final Class<T> clazz) {
index 5736c8e..755e541 100644 (file)
@@ -6,11 +6,9 @@
         <version>1.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
-
     <artifactId>docker</artifactId>
     <packaging>pom</packaging>
     <name>${project.artifactId}</name>
-
     <build>
         <finalName>${project.artifactId}-${project.version}</finalName>
         <plugins>
                 <groupId>io.fabric8</groupId>
                 <artifactId>docker-maven-plugin</artifactId>
                 <version>0.28.0</version>
-
                 <configuration>
                     <verbose>true</verbose>
                     <apiVersion>1.23</apiVersion>
                     <pullRegistry>${docker.pull.registry}</pullRegistry>
                     <pushRegistry>${docker.push.registry}</pushRegistry>
-
                     <images>
                         <image>
                             <name>jobs/workaround-job-container</name>
@@ -82,7 +78,6 @@
                         </image>
                     </images>
                 </configuration>
-
                 <executions>
                     <execution>
                         <id>clean-images</id>
@@ -94,7 +89,6 @@
                             <removeAll>true</removeAll>
                         </configuration>
                     </execution>
-
                     <execution>
                         <id>generate-images</id>
                         <phase>generate-sources</phase>
                         </goals>
                     </execution>
                 </executions>
-
             </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
             </plugin>
         </plugins>
     </build>
-
     <dependencies>
-
         <dependency>
             <groupId>org.onap.so.simulators</groupId>
             <artifactId>sdc-simulator</artifactId>
             <version>${project.version}</version>
         </dependency>
     </dependencies>
-
-
-</project>
+</project>
\ No newline at end of file
index 397d4a7..e5cc3d3 100644 (file)
@@ -1,15 +1,25 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <parent>
         <artifactId>so-simulators</artifactId>
         <groupId>org.onap.so.simulators</groupId>
         <version>1.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
-
     <artifactId>sdc-simulator</artifactId>
     <name>${project.artifactId}</name>
-
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-security</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-starter-tomcat</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+    </dependencies>
     <build>
         <plugins>
             <plugin>
@@ -32,5 +42,4 @@
             </plugin>
         </plugins>
     </build>
-
-</project>
+</project>
\ No newline at end of file
diff --git a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdc/simulator/configration/WebSecurityConfigImpl.java b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdc/simulator/configration/WebSecurityConfigImpl.java
new file mode 100644 (file)
index 0000000..bf97178
--- /dev/null
@@ -0,0 +1,71 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.sdc.simulator.configration;
+
+import org.onap.so.sdc.simulator.utils.Constants;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
+
+/**
+ * @author waqas.ikram@ericsson.com
+ *
+ */
+@Configuration
+@EnableWebSecurity
+public class WebSecurityConfigImpl extends WebSecurityConfigurerAdapter {
+
+    private final String username;
+    private final String password;
+    private final String role;
+
+    public WebSecurityConfigImpl(@Value("${spring.security.username}") final String username,
+            @Value("${spring.security.password}") final String password,
+            @Value("${spring.security.role}") final String role) {
+        this.username = username;
+        this.password = password;
+        this.role = role;
+    }
+
+
+    @Override
+    protected void configure(final HttpSecurity http) throws Exception {
+        http.csrf().disable().authorizeRequests().antMatchers(Constants.CATALOG_URL + "/**/**").authenticated().and()
+                .httpBasic();
+    }
+
+    @Bean
+    public BCryptPasswordEncoder passwordEncoder() {
+        return new BCryptPasswordEncoder();
+    }
+
+    @Autowired
+    public void configureGlobal(final AuthenticationManagerBuilder auth) throws Exception {
+        auth.inMemoryAuthentication().passwordEncoder(passwordEncoder()).withUser(username).password(password)
+                .roles(role);
+    }
+
+}
  * SPDX-License-Identifier: Apache-2.0
  * ============LICENSE_END=========================================================
  */
+package org.onap.so.sdc.simulator.controller;
 
-package org.onap.so.sdc.simulator;
-
+import static org.onap.so.sdc.simulator.utils.Constants.CATALOG_URL;
 import java.util.Optional;
 import javax.ws.rs.core.MediaType;
 import org.onap.so.sdc.simulator.providers.ResourceProvider;
-import org.onap.so.sdc.simulator.utils.Constant;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -32,30 +31,24 @@ import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseStatus;
 import org.springframework.web.bind.annotation.RestController;
 
 /**
  * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
  */
 @RestController
-@RequestMapping(path = Constant.BASE_URL)
-public class SdcSimulatorController {
-    private static final Logger LOGGER = LoggerFactory.getLogger(SdcSimulatorController.class);
+@RequestMapping(path = CATALOG_URL)
+public class CatalogController {
+    private static final Logger LOGGER = LoggerFactory.getLogger(CatalogController.class);
 
     private ResourceProvider resourceProvider;
 
-    public SdcSimulatorController(@Autowired final ResourceProvider resourceProvider) {
+    @Autowired
+    public CatalogController(final ResourceProvider resourceProvider) {
         this.resourceProvider = resourceProvider;
     }
 
-    @GetMapping(value = "/healthcheck", produces = MediaType.APPLICATION_JSON)
-    @ResponseStatus(code = HttpStatus.OK)
-    public String healthCheck() {
-        LOGGER.info("Running health check ...");
-        return Constant.HEALTHY;
-    }
-
     @GetMapping(value = "/resources/{csarId}/toscaModel", produces = MediaType.APPLICATION_OCTET_STREAM)
     public ResponseEntity<byte[]> getCsar(@PathVariable("csarId") final String csarId) {
         LOGGER.info("Running getCsar for {} ...", csarId);
diff --git a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdc/simulator/controller/SdcSimulatorController.java b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdc/simulator/controller/SdcSimulatorController.java
new file mode 100644 (file)
index 0000000..2baf203
--- /dev/null
@@ -0,0 +1,48 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.sdc.simulator.controller;
+
+import javax.ws.rs.core.MediaType;
+import org.onap.so.sdc.simulator.utils.Constants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseStatus;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ */
+@RestController
+@RequestMapping(path = Constants.BASE_URL)
+public class SdcSimulatorController {
+    private static final Logger LOGGER = LoggerFactory.getLogger(SdcSimulatorController.class);
+
+    @GetMapping(value = "/healthcheck", produces = MediaType.APPLICATION_JSON)
+    @ResponseStatus(code = HttpStatus.OK)
+    public String healthCheck() {
+        LOGGER.info("Running health check ...");
+        return Constants.HEALTHY;
+    }
+
+}
index cdc96f6..efc98de 100644 (file)
@@ -26,7 +26,7 @@ import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.Optional;
-import org.onap.so.sdc.simulator.utils.Constant;
+import org.onap.so.sdc.simulator.utils.Constants;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Value;
@@ -83,6 +83,6 @@ public class ResourceProviderImpl implements ResourceProvider {
      * Used in test
      */
     String getDefaultCsarPath() {
-        return Constant.DEFAULT_CSAR_PATH;
+        return Constants.DEFAULT_CSAR_PATH;
     }
 }
\ No newline at end of file
@@ -18,9 +18,11 @@ package org.onap.so.sdc.simulator.utils;
 /**
  * @author Waqas Ikram (waqas.ikram@est.tech)
  */
-public class Constant {
+public class Constants {
 
-    public static final String BASE_URL = "/simulator/sdc/v1/catalog";
+    public static final String BASE_URL = "/sdc/v1";
+
+    public static final String CATALOG_URL = BASE_URL + "/catalog";
 
     public static final String HEALTHY = "healthy";
 
@@ -35,6 +37,5 @@ public class Constant {
     public static final String DEFAULT_CSAR_PATH = "/csar/" + DEFAULT_CSAR_NAME_WITH_EXT;
 
 
-    private Constant() {
-    }
+    private Constants() {}
 }
index 89a13aa..5bb7950 100644 (file)
@@ -1,5 +1,11 @@
 server:
-  port: 9991
-  tomcat:
-    max-threads: 4
+   port: 9991
+   tomcat:
+      max-threads: 4
 ssl-enable: false
+spring:
+   security:
+      username: mso
+      #password: Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U
+      password: $2a$04$Lcu/DWdyXsl/a3A0iqHTfOX1.zHQ3DlQS/nOPfafT.9pWbeEqlF7W
+      role: mso
\ No newline at end of file
  * SPDX-License-Identifier: Apache-2.0
  * ============LICENSE_END=========================================================
  */
-
-package org.onap.so.sdc.simulator;
+package org.onap.so.sdc.simulator.controller;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
+import java.util.Base64;
 import java.util.Optional;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mockito;
 import org.onap.so.sdc.simulator.providers.ResourceProvider;
-import org.onap.so.sdc.simulator.utils.Constant;
+import org.onap.so.sdc.simulator.utils.Constants;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
 import org.springframework.boot.test.web.client.TestRestTemplate;
 import org.springframework.boot.web.server.LocalServerPort;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
 import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
 import org.springframework.http.ResponseEntity;
 import org.springframework.test.context.ActiveProfiles;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 
 /**
  * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
  */
 @RunWith(SpringJUnit4ClassRunner.class)
 @ActiveProfiles("test")
 @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
 @Configuration
-public class SdcSimulatorControllerTest {
+public class CatalogControllerTest {
+
+    private static final String PASSWORD = "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U";
 
     @LocalServerPort
     private int port;
@@ -55,42 +63,48 @@ public class SdcSimulatorControllerTest {
     @Autowired
     private TestRestTemplate restTemplate;
 
-    @Test
-    public void test_healthCheck_matchContent() {
-        final String url = getBaseUrl() + "/healthcheck";
-        final ResponseEntity<String> object = restTemplate.getForEntity(url, String.class);
-
-        assertEquals(Constant.HEALTHY, object.getBody());
-
-    }
+    @Value("${spring.security.username}")
+    private String username;
 
     @Test
     public void test_getCsar_validCsarId_matchContent() {
 
-        final String url = getBaseUrl() + "/resources/" + Constant.DEFAULT_CSAR_NAME + "/toscaModel";
+        final String url = getBaseUrl() + "/resources/" + Constants.DEFAULT_CSAR_NAME + "/toscaModel";
 
-        final ResponseEntity<byte[]> response = restTemplate.getForEntity(url, byte[].class);
+        final ResponseEntity<byte[]> response =
+                restTemplate.exchange(url, HttpMethod.GET, new HttpEntity<>(getHttpHeaders()), byte[].class);
 
+        assertEquals(HttpStatus.OK, response.getStatusCode());
         assertTrue(response.hasBody());
         assertEquals(3982, response.getBody().length);
 
-        assertEquals(HttpStatus.OK, response.getStatusCode());
     }
 
     @Test
     public void test_getCsar_invalidCsar_internalServerError() {
         final ResourceProvider mockedResourceProvider = Mockito.mock(ResourceProvider.class);
         Mockito.when(mockedResourceProvider.getResource(Mockito.anyString())).thenReturn(Optional.empty());
-        final SdcSimulatorController objUnderTest = new SdcSimulatorController(mockedResourceProvider);
+        final CatalogController objUnderTest = new CatalogController(mockedResourceProvider);
 
-        final ResponseEntity<byte[]> response = objUnderTest.getCsar(Constant.DEFAULT_CSAR_NAME);
+        final ResponseEntity<byte[]> response = objUnderTest.getCsar(Constants.DEFAULT_CSAR_NAME);
 
         assertFalse(response.hasBody());
         assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, response.getStatusCode());
     }
 
     private String getBaseUrl() {
-        return "http://localhost:" + port + Constant.BASE_URL;
+        return "http://localhost:" + port + Constants.CATALOG_URL;
+    }
+
+    private HttpHeaders getHttpHeaders() {
+        final HttpHeaders requestHeaders = new HttpHeaders();
+        requestHeaders.add("Authorization", getBasicAuth(username));
+        requestHeaders.setContentType(MediaType.APPLICATION_JSON);
+        return requestHeaders;
+    }
+
+    private String getBasicAuth(final String username) {
+        return "Basic " + new String(Base64.getEncoder().encodeToString((username + ":" + PASSWORD).getBytes()));
     }
 
 }
diff --git a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/test/java/org/onap/so/sdc/simulator/controller/SdcSimulatorControllerTest.java b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/test/java/org/onap/so/sdc/simulator/controller/SdcSimulatorControllerTest.java
new file mode 100644 (file)
index 0000000..300b62a
--- /dev/null
@@ -0,0 +1,61 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.sdc.simulator.controller;
+
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.so.sdc.simulator.utils.Constants;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
+import org.springframework.boot.test.web.client.TestRestTemplate;
+import org.springframework.boot.web.server.LocalServerPort;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.ResponseEntity;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ */
+@RunWith(SpringJUnit4ClassRunner.class)
+@ActiveProfiles("test")
+@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
+@Configuration
+public class SdcSimulatorControllerTest {
+
+    @LocalServerPort
+    private int port;
+
+    @Autowired
+    private TestRestTemplate restTemplate;
+
+    @Test
+    public void test_healthCheck_matchContent() {
+        final String url = "http://localhost:" + port + Constants.BASE_URL + "/healthcheck";
+        final ResponseEntity<String> object = restTemplate.getForEntity(url, String.class);
+
+        assertEquals(Constants.HEALTHY, object.getBody());
+
+    }
+
+}
index 4871d51..b112c40 100644 (file)
@@ -30,7 +30,7 @@ import java.nio.file.Path;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
-import org.onap.so.sdc.simulator.utils.Constant;
+import org.onap.so.sdc.simulator.utils.Constants;
 import org.springframework.core.io.ClassPathResource;
 import org.springframework.util.StreamUtils;
 
@@ -59,13 +59,13 @@ public class ResourceProviderImplTest {
 
     @Test
     public void test_getResource_withoutValidPath_matchContent() throws IOException {
-        final ClassPathResource classPathResource = new ClassPathResource(Constant.DEFAULT_CSAR_PATH, this.getClass());
+        final ClassPathResource classPathResource = new ClassPathResource(Constants.DEFAULT_CSAR_PATH, this.getClass());
 
         final byte[] expectedResult = StreamUtils.copyToByteArray(classPathResource.getInputStream());
 
         final ResourceProviderImpl objUnderTest = new ResourceProviderImpl("");
 
-        assertArrayEquals(expectedResult, objUnderTest.getResource(Constant.DEFAULT_CSAR_NAME).get());
+        assertArrayEquals(expectedResult, objUnderTest.getResource(Constants.DEFAULT_CSAR_NAME).get());
     }
 
     @Test
@@ -77,7 +77,7 @@ public class ResourceProviderImplTest {
                 return "/some/dummy/path";
             }
         };
-        assertFalse(objUnderTest.getResource(Constant.DEFAULT_CSAR_NAME).isPresent());
+        assertFalse(objUnderTest.getResource(Constants.DEFAULT_CSAR_NAME).isPresent());
 
     }