diff options
author | xg353y <xg353y@intl.att.com> | 2018-08-10 09:28:01 +0200 |
---|---|---|
committer | xg353y <xg353y@intl.att.com> | 2018-08-10 10:12:16 +0200 |
commit | 00fd66d0e738d6396527ae8c0eb1d8a8fe5c88a4 (patch) | |
tree | fe52a8a56ee3bf0a97624a85b1b0cd7b62d06101 /src/test/java | |
parent | 499e4e89cb68c99547df5632df358847b62ccc3f (diff) |
Update Logging Specifications
Update logging related parameters basedon the ONAP logging specification
v1.2
Issue-ID: CLAMP-203, CLAMP-204, CLAMP-205
Change-Id: Ide7608e289f647862be8db6eb3d7bf11b6e7218a
Signed-off-by: xg353y <xg353y@intl.att.com>
Diffstat (limited to 'src/test/java')
-rw-r--r-- | src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java | 12 | ||||
-rw-r--r-- | src/test/java/org/onap/clamp/clds/it/CldsTemplateServiceItCase.java | 14 |
2 files changed, 21 insertions, 5 deletions
diff --git a/src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java b/src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java index f61a33e3e..8e7e70d89 100644 --- a/src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java @@ -39,11 +39,14 @@ import java.util.LinkedList; import java.util.List; import java.util.Properties; +import javax.servlet.http.HttpServletRequest; + import org.apache.commons.codec.DecoderException; import org.json.JSONException; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.Matchers; import org.mockito.Mockito; import org.onap.clamp.clds.dao.CldsDao; import org.onap.clamp.clds.model.CldsHealthCheck; @@ -52,6 +55,7 @@ import org.onap.clamp.clds.model.CldsModel; import org.onap.clamp.clds.model.CldsServiceData; import org.onap.clamp.clds.model.CldsTemplate; import org.onap.clamp.clds.service.CldsService; +import org.onap.clamp.clds.util.LoggingUtils; import org.onap.clamp.clds.util.ResourceFileUtil; import org.skyscreamer.jsonassert.JSONAssert; import org.springframework.beans.factory.annotation.Autowired; @@ -62,7 +66,6 @@ import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.Authentication; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.context.SecurityContext; -import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.userdetails.User; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -83,7 +86,7 @@ public class CldsServiceItCase { private CldsDao cldsDao; private Authentication authentication; private List<GrantedAuthority> authList = new LinkedList<GrantedAuthority>(); - + private LoggingUtils util; /** * Setup the variable before the tests execution. * @@ -102,6 +105,10 @@ public class CldsServiceItCase { authList.add(new SimpleGrantedAuthority("permission-type-template|dev|update")); authList.add(new SimpleGrantedAuthority("permission-type-filter-vf|dev|*")); authentication = new UsernamePasswordAuthenticationToken(new User("admin", "", authList), "", authList); + + util = Mockito.mock(LoggingUtils.class); + Mockito.doNothing().when(util).entering(Matchers.any(HttpServletRequest.class), Matchers.any(String.class)); + cldsService.setLoggingUtil(util); } @Test @@ -144,6 +151,7 @@ public class CldsServiceItCase { public void testPutModel() { SecurityContext securityContext = Mockito.mock(SecurityContext.class); Mockito.when(securityContext.getAuthentication()).thenReturn(authentication); + cldsService.setSecurityContext(securityContext); // Add the template first CldsTemplate newTemplate = new CldsTemplate(); diff --git a/src/test/java/org/onap/clamp/clds/it/CldsTemplateServiceItCase.java b/src/test/java/org/onap/clamp/clds/it/CldsTemplateServiceItCase.java index 913e49a45..ba8b0b79d 100644 --- a/src/test/java/org/onap/clamp/clds/it/CldsTemplateServiceItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/CldsTemplateServiceItCase.java @@ -35,14 +35,18 @@ import java.security.Principal; import java.util.LinkedList; import java.util.List; +import javax.servlet.http.HttpServletRequest; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.Matchers; import org.mockito.Mockito; import org.onap.clamp.clds.dao.CldsDao; import org.onap.clamp.clds.model.CldsTemplate; import org.onap.clamp.clds.model.ValueItem; import org.onap.clamp.clds.service.CldsTemplateService; +import org.onap.clamp.clds.util.LoggingUtils; import org.onap.clamp.clds.util.ResourceFileUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -74,6 +78,7 @@ public class CldsTemplateServiceItCase { private CldsTemplate cldsTemplate; private Authentication authentication; private List<GrantedAuthority> authList = new LinkedList<GrantedAuthority>(); + private LoggingUtils util; /** * Setup the variable before the tests execution. @@ -89,11 +94,14 @@ public class CldsTemplateServiceItCase { authList.add(new SimpleGrantedAuthority("permission-type-template|dev|update")); authList.add(new SimpleGrantedAuthority("permission-type-filter-vf|dev|*")); authentication = new UsernamePasswordAuthenticationToken(new User("admin", "", authList), "", authList); - + SecurityContext securityContext = Mockito.mock(SecurityContext.class); Mockito.when(securityContext.getAuthentication()).thenReturn(authentication); - - + + util = Mockito.mock(LoggingUtils.class); + Mockito.doNothing().when(util).entering(Matchers.any(HttpServletRequest.class), Matchers.any(String.class)); + cldsTemplateService.setLoggingUtil(util); + cldsTemplateService.setSecurityContext(securityContext); bpmnText = ResourceFileUtil.getResourceAsString("example/dao/bpmn-template.xml"); imageText = ResourceFileUtil.getResourceAsString("example/dao/image-template.xml"); |