From 493086e5454732e73411fbb27df4a37ea87964bf Mon Sep 17 00:00:00 2001
From: Joze RIHTARSIC <joze.rihtarsic@ext.ec.europa.eu>
Date: Wed, 28 Nov 2018 12:16:55 +0100
Subject: [PATCH] - add new unit test for keystore

---
 .../services/ui/UIServiceGroupService.java    |   3 +
 .../ec/edelivery/smp/ui/SearchResource.java   |   3 -
 .../edelivery/smp/ui/SearchResourceTest.java  |  88 ++++++++++++++++++
 .../smp/ui/ServiceGroupResourceTest.java      |  85 ++++++++++++++---
 .../test/resources/input/extensionMarshal.xml |   1 +
 .../smp-keystore_multiple_domains.jks         | Bin 7870 -> 19597 bytes
 .../webapp_integration_test_data.sql          |   3 +
 7 files changed, 165 insertions(+), 18 deletions(-)
 create mode 100644 smp-webapp/src/test/java/eu/europa/ec/edelivery/smp/ui/SearchResourceTest.java
 create mode 100644 smp-webapp/src/test/resources/input/extensionMarshal.xml

diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ui/UIServiceGroupService.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ui/UIServiceGroupService.java
index 112ee3bfd..cae380392 100644
--- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ui/UIServiceGroupService.java
+++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ui/UIServiceGroupService.java
@@ -117,6 +117,9 @@ public class UIServiceGroupService extends UIServiceBase<DBServiceGroup, Service
         ServiceGroupValidationRO ex = new ServiceGroupValidationRO();
         DBServiceGroup dbServiceGroup = getDatabaseDao().find(serviceGroupId);
         ex.setServiceGroupId(dbServiceGroup.getId());
+        ex.setParticipantIdentifier(dbServiceGroup.getParticipantIdentifier());
+        ex.setParticipantScheme(dbServiceGroup.getParticipantScheme());
+
         if (dbServiceGroup.getExtension() != null) {
             ex.setExtension(new String(dbServiceGroup.getExtension()));
         }
diff --git a/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/ui/SearchResource.java b/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/ui/SearchResource.java
index 5d3cc7db9..df6f2ae10 100644
--- a/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/ui/SearchResource.java
+++ b/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/ui/SearchResource.java
@@ -35,10 +35,7 @@ public class SearchResource {
     private UIServiceGroupSearchService uiServiceGroupService;
     @Autowired
     private DomainDao domainDao;
-    @PostConstruct
-    protected void init() {
 
-    }
 
     @PutMapping(produces = {"application/json"})
     @ResponseBody
diff --git a/smp-webapp/src/test/java/eu/europa/ec/edelivery/smp/ui/SearchResourceTest.java b/smp-webapp/src/test/java/eu/europa/ec/edelivery/smp/ui/SearchResourceTest.java
new file mode 100644
index 000000000..d80da95a0
--- /dev/null
+++ b/smp-webapp/src/test/java/eu/europa/ec/edelivery/smp/ui/SearchResourceTest.java
@@ -0,0 +1,88 @@
+package eu.europa.ec.edelivery.smp.ui;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import eu.europa.ec.edelivery.smp.config.PropertiesTestConfig;
+import eu.europa.ec.edelivery.smp.config.SmpAppConfig;
+import eu.europa.ec.edelivery.smp.config.SmpWebAppConfig;
+import eu.europa.ec.edelivery.smp.config.SpringSecurityConfig;
+import eu.europa.ec.edelivery.smp.data.ui.ServiceGroupRO;
+import eu.europa.ec.edelivery.smp.data.ui.ServiceResult;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.mock.web.MockServletContext;
+import org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.jdbc.Sql;
+import org.springframework.test.context.jdbc.SqlConfig;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.MvcResult;
+import org.springframework.test.web.servlet.request.RequestPostProcessor;
+import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+import org.springframework.web.context.ContextLoaderListener;
+import org.springframework.web.context.WebApplicationContext;
+
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+import static org.junit.Assert.*;
+import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.httpBasic;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+
+
+/**
+ * @author Joze Rihtarsic
+ * @since 4.1
+ */
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = {
+        PropertiesTestConfig.class,
+        SmpAppConfig.class,
+        SmpWebAppConfig.class,
+        SpringSecurityConfig.class})
+@WebAppConfiguration
+@Sql("classpath:/cleanup-database.sql")
+@Sql("classpath:/webapp_integration_test_data.sql")
+@SqlConfig(encoding = "UTF-8")
+public class SearchResourceTest {
+
+    private static final String PATH="/ui/rest/search";
+
+
+    @Autowired
+    private WebApplicationContext webAppContext;
+
+    private MockMvc mvc;
+    @Before
+    public void setup() {
+        mvc = MockMvcBuilders.webAppContextSetup(webAppContext)
+                .apply(SecurityMockMvcConfigurers.springSecurity())
+                .build();
+
+        initServletContext();
+    }
+
+    private void initServletContext() {
+        MockServletContext sc = new MockServletContext("");
+        ServletContextListener listener = new ContextLoaderListener(webAppContext);
+        ServletContextEvent event = new ServletContextEvent(sc);
+    }
+
+    @Test
+    public void testSearchByAnonymous() throws Exception {
+        // given when
+        MvcResult result = mvc.perform(get(PATH)
+        ).andExpect(status().isOk()).andReturn();
+
+        //then
+        ObjectMapper mapper = new ObjectMapper();
+        ServiceResult res = mapper.readValue(result.getResponse().getContentAsString(), ServiceResult.class);
+
+        assertNotNull(res);
+        assertEquals(2, res.getServiceEntities().size());
+    }
+}
\ No newline at end of file
diff --git a/smp-webapp/src/test/java/eu/europa/ec/edelivery/smp/ui/ServiceGroupResourceTest.java b/smp-webapp/src/test/java/eu/europa/ec/edelivery/smp/ui/ServiceGroupResourceTest.java
index ac1a1185e..954657a40 100644
--- a/smp-webapp/src/test/java/eu/europa/ec/edelivery/smp/ui/ServiceGroupResourceTest.java
+++ b/smp-webapp/src/test/java/eu/europa/ec/edelivery/smp/ui/ServiceGroupResourceTest.java
@@ -5,8 +5,12 @@ import eu.europa.ec.edelivery.smp.config.PropertiesTestConfig;
 import eu.europa.ec.edelivery.smp.config.SmpAppConfig;
 import eu.europa.ec.edelivery.smp.config.SmpWebAppConfig;
 import eu.europa.ec.edelivery.smp.config.SpringSecurityConfig;
+import eu.europa.ec.edelivery.smp.data.dao.ServiceGroupDao;
+import eu.europa.ec.edelivery.smp.data.model.DBServiceGroup;
 import eu.europa.ec.edelivery.smp.data.ui.ServiceGroupRO;
+import eu.europa.ec.edelivery.smp.data.ui.ServiceGroupValidationRO;
 import eu.europa.ec.edelivery.smp.data.ui.ServiceResult;
+import org.apache.commons.io.IOUtils;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -25,14 +29,17 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders;
 import org.springframework.web.context.ContextLoaderListener;
 import org.springframework.web.context.WebApplicationContext;
 
+
 import javax.servlet.ServletContextEvent;
 import javax.servlet.ServletContextListener;
+import javax.xml.ws.spi.WebServiceFeatureAnnotation;
+
+import java.io.IOException;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.*;
 import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.httpBasic;
 import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
 import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
 
 /**
@@ -51,10 +58,15 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
 @SqlConfig(encoding = "UTF-8")
 public class ServiceGroupResourceTest {
 
-    private static final String PATH="/ui/rest/servicegroup";
+    @Autowired
+    ServiceGroupDao serviceGroupDao;
+
+    private static final String PATH = "/ui/rest/servicegroup";
+
+    private static final String PARTICIPANT_IDENTIFIER = "urn:australia:ncpb";
+    private static final String PARTICIPANT_SCHEME = "ehealth-actorid-qns";
 
-    private static final String PARTICIPANT_IDENTIFIER= "urn:australia:ncpb";
-    private static final String PARTICIPANT_SCHEME= "ehealth-actorid-qns";
+    private String validExtension = null;
 
     @Autowired
     private WebApplicationContext webAppContext;
@@ -62,13 +74,15 @@ public class ServiceGroupResourceTest {
     private MockMvc mvc;
     private static final RequestPostProcessor SMP_ADMIN_CREDENTIALS = httpBasic("smp_admin", "test123");
     private static final RequestPostProcessor SG_ADMIN_CREDENTIALS = httpBasic("sg_admin", "test123");
+
     @Before
-    public void setup() {
+    public void setup() throws IOException {
         mvc = MockMvcBuilders.webAppContextSetup(webAppContext)
                 .apply(SecurityMockMvcConfigurers.springSecurity())
                 .build();
 
         initServletContext();
+        validExtension = new String(IOUtils.toByteArray(ServiceGroupResourceTest.class.getResourceAsStream("/input/extensionMarshal.xml")));
     }
 
     private void initServletContext() {
@@ -91,14 +105,13 @@ public class ServiceGroupResourceTest {
 
         assertNotNull(res);
         assertEquals(2, res.getServiceEntities().size());
-        res.getServiceEntities().forEach(sgMap-> {
-            ServiceGroupRO  sgro = mapper.convertValue(sgMap, ServiceGroupRO.class);
+        res.getServiceEntities().forEach(sgMap -> {
+            ServiceGroupRO sgro = mapper.convertValue(sgMap, ServiceGroupRO.class);
             assertNotNull(sgro.getId());
             assertNotNull(sgro.getParticipantScheme());
             assertNotNull(sgro.getParticipantIdentifier());
             assertEquals(1, sgro.getUsers().size());
             assertNotEquals("smp_admin", sgro.getUsers().get(0).getUsername());
-
         });
     }
 
@@ -113,11 +126,10 @@ public class ServiceGroupResourceTest {
         ObjectMapper mapper = new ObjectMapper();
         ServiceResult res = mapper.readValue(result.getResponse().getContentAsString(), ServiceResult.class);
 
-
         assertNotNull(res);
         assertEquals(1, res.getServiceEntities().size());
-        res.getServiceEntities().forEach(sgMap-> {
-            ServiceGroupRO  sgro = mapper.convertValue(sgMap, ServiceGroupRO.class);
+        res.getServiceEntities().forEach(sgMap -> {
+            ServiceGroupRO sgro = mapper.convertValue(sgMap, ServiceGroupRO.class);
             assertNotNull(sgro.getId());
             assertNotNull(sgro.getParticipantScheme());
             assertNotNull(sgro.getParticipantIdentifier());
@@ -127,10 +139,10 @@ public class ServiceGroupResourceTest {
     }
 
     @Test
-    public void getServiceGroupById() throws Exception{
+    public void getServiceGroupById() throws Exception {
 
         // given when
-        MvcResult result = mvc.perform(get(PATH+"/100000")
+        MvcResult result = mvc.perform(get(PATH + "/100000")
                 .with(SMP_ADMIN_CREDENTIALS)).
                 andExpect(status().isOk()).andReturn();
 
@@ -151,5 +163,48 @@ public class ServiceGroupResourceTest {
         assertEquals(res.getServiceGroupDomains().get(0).getId(), res.getServiceMetadata().get(0).getServiceGroupDomainId());
     }
 
+    @Test
+    public void getExtensionServiceGroupById() throws Exception {
+
+        DBServiceGroup sg = serviceGroupDao.findServiceGroup(PARTICIPANT_IDENTIFIER, PARTICIPANT_SCHEME).get();
+        sg.setExtension(validExtension.getBytes());
+        serviceGroupDao.update(sg);
+
+        // given when
+        MvcResult result = mvc.perform(get(PATH + "/extension/100000")
+                .with(SMP_ADMIN_CREDENTIALS)).
+                andExpect(status().isOk()).andReturn();
+
+        //them
+        ObjectMapper mapper = new ObjectMapper();
+        ServiceGroupValidationRO res = mapper.readValue(result.getResponse().getContentAsString(), ServiceGroupValidationRO.class);
+
+        assertNotNull(res);
+        assertEquals(100000, res.getServiceGroupId().longValue());
+        assertEquals(PARTICIPANT_IDENTIFIER, res.getParticipantIdentifier());
+        assertEquals(PARTICIPANT_SCHEME, res.getParticipantScheme());
+        assertEquals(new String(sg.getExtension()), res.getExtension());
+    }
+
+    @Test
+    public void testValidateInvald() throws Exception {
+        ObjectMapper mapper = new ObjectMapper();
+        ServiceGroupValidationRO validate = new ServiceGroupValidationRO();
+        validate.setExtension(validExtension + "<ADFA>sdfadsf");
+
+        // given when
+        MvcResult result = mvc.perform(post(PATH + "/extension/validate")
+                .with(SMP_ADMIN_CREDENTIALS)
+                .header("Content-Type","application/json")
+                    .content(mapper.writeValueAsString(validate)))
+                .andExpect(status().isOk()).andReturn();
+
+        //then
+        ServiceGroupValidationRO res = mapper.readValue(result.getResponse().getContentAsString(), ServiceGroupValidationRO.class);
+
+        assertNotNull(res);
+        assertNotNull(res.getErrorMessage());
+    }
+
 
 }
\ No newline at end of file
diff --git a/smp-webapp/src/test/resources/input/extensionMarshal.xml b/smp-webapp/src/test/resources/input/extensionMarshal.xml
new file mode 100644
index 000000000..7c20d3eb5
--- /dev/null
+++ b/smp-webapp/src/test/resources/input/extensionMarshal.xml
@@ -0,0 +1 @@
+<Extension xmlns:ns2="http://www.w3.org/2000/09/xmldsig#" xmlns="http://docs.oasis-open.org/bdxr/ns/SMP/2016/05"><ExtensionID>id1</ExtensionID><ExtensionName>name1</ExtensionName><ExtensionAgencyName>agencyName1</ExtensionAgencyName><ExtensionAgencyURI>agencyUri1</ExtensionAgencyURI><ExtensionVersionID>versionId1</ExtensionVersionID><ExtensionReasonCode>reasonCode1</ExtensionReasonCode><ExtensionReason>reason1</ExtensionReason></Extension>
diff --git a/smp-webapp/src/test/resources/keystores/smp-keystore_multiple_domains.jks b/smp-webapp/src/test/resources/keystores/smp-keystore_multiple_domains.jks
index 716ca6ad4f15ec132c0bc17648b0eafb2cd2ee9f..f39554fdca1882a93ebbd7f68132d97e1e412cdf 100644
GIT binary patch
delta 6249
zcmdmI+dGqy=il3ZZy6XEm>3us_$OPlN^zPqFfgV^UY@sQ@_Z4Q`n+?u7sZ_CpQ`TN
zqf|G~Z@*26XLHzsxtA_g#Q&L7pPk`jCT1ogwZm0Q_`gENor_(pYq}$sbyS}eXbvx*
zaeZ>aroI&8D*^>;Hv}H6wUV@aqT$q{y>|Ot=}o12Mn|`PY@Plh@WG<$Q+AW0Pgd?e
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yUlLS}1pu)y7-9eb

diff --git a/smp-webapp/src/test/resources/webapp_integration_test_data.sql b/smp-webapp/src/test/resources/webapp_integration_test_data.sql
index 41c220792..3dcd14469 100644
--- a/smp-webapp/src/test/resources/webapp_integration_test_data.sql
+++ b/smp-webapp/src/test/resources/webapp_integration_test_data.sql
@@ -30,6 +30,9 @@ insert into SMP_CERTIFICATE (ID, CERTIFICATE_ID, VALID_FROM, VALID_TO, CREATED_O
 -- set the ids to higher values - tests are using sequnce which stars from 1
 insert into SMP_SERVICE_GROUP(ID, PARTICIPANT_IDENTIFIER, PARTICIPANT_SCHEME, CREATED_ON, LAST_UPDATED_ON) values (100000, 'urn:australia:ncpb', 'ehealth-actorid-qns', CURRENT_TIMESTAMP(),CURRENT_TIMESTAMP());
 insert into SMP_SERVICE_GROUP(ID, PARTICIPANT_IDENTIFIER, PARTICIPANT_SCHEME, CREATED_ON, LAST_UPDATED_ON) values (200000, 'urn:brazil:ncpb', 'ehealth-actorid-qns', CURRENT_TIMESTAMP(),CURRENT_TIMESTAMP());
+--insert into SMP_SG_EXTENSION(ID, EXTENSION,CREATED_ON, LAST_UPDATED_ON) values (100000, '<Extension xmlns:ns2="http://www.w3.org/2000/09/xmldsig#" xmlns="http://docs.oasis-open.org/bdxr/ns/SMP/2016/05"><ExtensionID>id1</ExtensionID><ExtensionName>name1</ExtensionName><ExtensionAgencyName>agencyName1</ExtensionAgencyName><ExtensionAgencyURI>agencyUri1</ExtensionAgencyURI><ExtensionVersionID>versionId1</ExtensionVersionID><ExtensionReasonCode>reasonCode1</ExtensionReasonCode><ExtensionReason>reason1</ExtensionReason></Extension>', CURRENT_TIMESTAMP(),CURRENT_TIMESTAMP());
+
+
 
 -- set ownership
 insert into SMP_OWNERSHIP (FK_SG_ID, FK_USER_ID) values (100000, 4);
-- 
GitLab