diff --git a/README.md b/README.md index 5db07d32f3..29624f4fde 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -[![Maven Package upon a push](https://github.com/mosip/packet-manager/actions/workflows/push_trigger.yml/badge.svg?branch=release-1.2.0.1)](https://github.com/mosip/packet-manager/actions/workflows/push_trigger.yml) -[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?branch=release-1.2.0.1&project=mosip_packet-manager&id=mosip_packet-manager2&metric=alert_status)](https://sonarcloud.io/dashboard?branch=release-1.2.0.1&id=mosip_packet-manager) +[![Maven Package upon a push](https://github.com/mosip/packet-manager/actions/workflows/push-trigger.yml/badge.svg?branch=release-1.3.x)](https://github.com/mosip/packet-manager/actions/workflows/push-trigger.yml) +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?branch=release-1.3.x&project=mosip_packet-manager&id=mosip_packet-manager2&metric=alert_status)](https://sonarcloud.io/dashboard?branch=release-1.3.x&id=mosip_packet-manager) # Packet Manager diff --git a/commons-packet/commons-packet-manager/pom.xml b/commons-packet/commons-packet-manager/pom.xml index 2a8921ef70..7ffea9379a 100644 --- a/commons-packet/commons-packet-manager/pom.xml +++ b/commons-packet/commons-packet-manager/pom.xml @@ -1,328 +1,327 @@ - - - - 4.0.0 - io.mosip.commons - commons-packet-manager - commons-packet-manager - Mosip commons project - https://github.com/mosip/commons - 1.2.1-SNAPSHOT - - - UTF-8 - 21 - 21 - 3.8.0 - 3.0.2 - 3.1.0 - 3.2.0 - 2.3 - 2.8.1 - 2.2.1 - 1.5 - 0.7.0 - 3.0.1 - 2.22.0 - 1.2.1-SNAPSHOT - 2.2.1 - - 1.2.1-SNAPSHOT - 1.2.1-SNAPSHOT - 1.2.1-SNAPSHOT - 1.2.1-SNAPSHOT - 1.2.1-SNAPSHOT - 1.2.1-SNAPSHOT - 1.2.1-SNAPSHOT - 1.2.1-SNAPSHOT - 1.2.1-SNAPSHOT - 1.2.1-SNAPSHOT - 1.2.1-SNAPSHOT - 3.11.2 - **/constants/**,**/config/**,**/audit/**,**/util/**,**/dto/**,**/entity/**,**/model/**,**/exception/**,**/repository/**,**/security/**,**/*Config.java,**/*BootApplication.java,**/*VertxApplication.java,**/cbeffutil/**,**/*Utils.java,**/*Validator.java,**/*Helper.java,**/verticle/**,**/VidWriter.java/**,**/masterdata/utils/**,**/spi/**,**/core/http/**,"**/LocationServiceImpl.java","**/RegistrationCenterMachineServiceImpl.java","**/RegistrationCenterServiceImpl.java","**/pridgenerator/**","**/idgenerator/prid","**/proxy/**","**/cryptosignature/**" - **/dto/**,**/entity/**,**/config/** - 0.8.11 - - - - - - io.mosip.kernel - kernel-bom - ${kernel.bom.version} - pom - import - - - - - - io.mosip.kernel - kernel-idobjectvalidator - ${kernel-idobjectvalidator.version} - - - org.springframework.boot - spring-boot-starter-security - - - io.mosip.kernel - kernel-core - ${kernel.core.version} - - - com.hazelcast - hazelcast-kubernetes - ${hazelcast.kubernetes.version} - - - com.googlecode.json-simple - json-simple - - - io.mosip.kernel - kernel-logger-logback - ${kernel.logger.logback.version} - - - io.mosip.kernel - kernel-cbeffutil-api - ${kernel.cbeffutil.api.version} - - - io.mosip.kernel - kernel-biometrics-api - ${kernel.biometrics.api.version} - - - org.springframework.boot - spring-boot-starter-cache - - - io.mosip.commons - khazana - ${khazana.version} - - - org.powermock - powermock-module-junit4 - test - - - org.powermock - powermock-api-mockito2 - test - - - jakarta.xml.bind - jakarta.xml.bind-api - - - io.mosip.kernel - kernel-keymanager-service - ${kernel-keymanager-service.version} - - - org.springframework.security - spring-security-config - - - lib - - - junit - junit - test - - - org.apache.commons - commons-collections4 - - - org.junit.vintage - junit-vintage-engine - - - org.mockito - mockito-core - ${mockito.core.version} - - - - - - ossrh - https://central.sonatype.com/repository/maven-snapshots/ - - - ossrh - https://central.sonatype.com/api/v1/publisher - - - - - - org.apache.maven.plugins - maven-surefire-plugin - ${maven.surefire.plugin.version} - - false - false - - --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --enable-preview - - - - - org.apache.maven.plugins - maven-compiler-plugin - - ${maven.compiler.source} - ${maven.compiler.target} - - - - - maven-deploy-plugin - ${maven.deploy.plugin.version} - - - default-deploy - deploy - - deploy - - - - - - org.sonatype.central - central-publishing-maven-plugin - ${central.publishing.maven.plugin.version} - true - - ossrh - false - - - - org.apache.maven.plugins - maven-source-plugin - true - ${maven.source.plugin.version} - - - attach-sources - - jar-no-fork - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - ${maven.javadoc.version} - - - attach-javadocs - - jar - - - - - none - - - - org.apache.maven.plugins - maven-gpg-plugin - ${maven.gpg.plugin.version} - - - sign-artifacts - verify - - sign - - - - --pinentry-mode - loopback - - - - - - - - org.jacoco - jacoco-maven-plugin - ${jacoco.maven.plugin.version} - - - - prepare-agent - - - - report - prepare-package - - report - - - - - - pl.project13.maven - git-commit-id-plugin - ${git.commit.plugin.version} - - - get-the-git-infos - - revision - - validate - - - - true - ${project.build.outputDirectory}/git.properties - - ^git.build.(time|version)$ - ^git.commit.id.(abbrev|full)$ - - full - ${project.basedir}/.git - - - - - - - scm:git:git://github.com/mosip/packet-manager.git - scm:git:ssh://github.com:mosip/packet-manager.git - https://github.com/mosip/commons - HEAD - - - - MPL 2.0 - https://www.mozilla.org/en-US/MPL/2.0/ - - - - - Mosip - mosip.emailnotifier@gmail.com - io.mosip - https://github.com/mosip/commons - - - + + + + 4.0.0 + io.mosip.commons + commons-packet-manager + commons-packet-manager + Mosip commons project + https://github.com/mosip/commons + 1.3.0-beta.2 + + + UTF-8 + 21 + 21 + 3.8.0 + 3.0.2 + 3.1.0 + 3.2.0 + 2.3 + 2.8.1 + 2.2.1 + 1.5 + 0.7.0 + 3.0.1 + 2.22.0 + 1.3.1 + + 1.3.0-beta.3 + 1.3.0-beta.2 + 1.3.0-beta.2 + 1.3.0-beta.1 + 1.3.0-beta.1 + 1.3.0-beta.1 + 1.3.0-beta.2 + 1.3.0-beta.2 + 1.2.2-SNAPSHOT + 1.3.0-beta.2 + 3.11.2 + **/constants/**,**/config/**,**/audit/**,**/util/**,**/dto/**,**/entity/**,**/model/**,**/exception/**,**/repository/**,**/security/**,**/*Config.java,**/*BootApplication.java,**/*VertxApplication.java,**/cbeffutil/**,**/*Utils.java,**/*Validator.java,**/*Helper.java,**/verticle/**,**/VidWriter.java/**,**/masterdata/utils/**,**/spi/**,**/core/http/**,"**/LocationServiceImpl.java","**/RegistrationCenterMachineServiceImpl.java","**/RegistrationCenterServiceImpl.java","**/pridgenerator/**","**/idgenerator/prid","**/proxy/**","**/cryptosignature/**" + **/dto/**,**/entity/**,**/config/** + 0.8.11 + + + + + + io.mosip.kernel + kernel-bom + ${kernel.bom.version} + pom + import + + + + + + io.mosip.kernel + kernel-idobjectvalidator + ${kernel-idobjectvalidator.version} + + + org.springframework.boot + spring-boot-starter-security + + + io.mosip.kernel + kernel-core + ${kernel.core.version} + + + com.hazelcast + hazelcast-kubernetes + ${hazelcast.kubernetes.version} + + + com.googlecode.json-simple + json-simple + + + io.mosip.kernel + kernel-logger-logback + ${kernel.logger.logback.version} + + + io.mosip.kernel + kernel-cbeffutil-api + ${kernel.cbeffutil.api.version} + + + io.mosip.kernel + kernel-biometrics-api + ${kernel.biometrics.api.version} + + + org.springframework.boot + spring-boot-starter-cache + + + io.mosip.commons + khazana + ${khazana.version} + + + org.powermock + powermock-module-junit4 + test + + + org.powermock + powermock-api-mockito2 + test + + + jakarta.xml.bind + jakarta.xml.bind-api + + + io.mosip.kernel + kernel-keymanager-service + ${kernel-keymanager-service.version} + + + org.springframework.security + spring-security-config + + + lib + + + junit + junit + test + + + org.apache.commons + commons-collections4 + + + org.junit.vintage + junit-vintage-engine + + + org.mockito + mockito-core + ${mockito.core.version} + + + + + + + ossrh + https://central.sonatype.com/repository/maven-snapshots/ + + + ossrh + https://central.sonatype.com/api/v1/publisher + + + + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven.surefire.plugin.version} + + false + false + + --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --enable-preview + + + + + org.apache.maven.plugins + maven-compiler-plugin + + ${maven.compiler.source} + ${maven.compiler.target} + + + + + maven-deploy-plugin + ${maven.deploy.plugin.version} + + + default-deploy + deploy + + deploy + + + + + + org.sonatype.central + central-publishing-maven-plugin + ${central.publishing.maven.plugin.version} + true + + ossrh + false + + + + org.apache.maven.plugins + maven-source-plugin + true + ${maven.source.plugin.version} + + + attach-sources + + jar-no-fork + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + ${maven.javadoc.version} + + + attach-javadocs + + jar + + + + + none + + + + org.apache.maven.plugins + maven-gpg-plugin + ${maven.gpg.plugin.version} + + + sign-artifacts + verify + + sign + + + + --pinentry-mode + loopback + + + + + + + + org.jacoco + jacoco-maven-plugin + ${jacoco.maven.plugin.version} + + + + prepare-agent + + + + report + prepare-package + + report + + + + + + pl.project13.maven + git-commit-id-plugin + ${git.commit.plugin.version} + + + get-the-git-infos + + revision + + validate + + + + true + ${project.build.outputDirectory}/git.properties + + ^git.build.(time|version)$ + ^git.commit.id.(abbrev|full)$ + + full + ${project.basedir}/.git + + + + + + + scm:git:git://github.com/mosip/packet-manager.git + scm:git:ssh://github.com:mosip/packet-manager.git + https://github.com/mosip/commons + HEAD + + + + MPL 2.0 + https://www.mozilla.org/en-US/MPL/2.0/ + + + + + Mosip + mosip.emailnotifier@gmail.com + io.mosip + https://github.com/mosip/commons + + + \ No newline at end of file diff --git a/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/audit/AuditLogEntryTest.java b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/audit/AuditLogEntryTest.java new file mode 100644 index 0000000000..deca5cb183 --- /dev/null +++ b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/audit/AuditLogEntryTest.java @@ -0,0 +1,21 @@ +package io.mosip.commons.packet.test.audit; + +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import io.mosip.commons.packet.audit.AuditLogEntry; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class AuditLogEntryTest { + + @Test + public void testAuditLogEntry() { + AuditLogEntry auditLogEntry = new AuditLogEntry("test-event", "test-type", "test-app-id", "test-app-name"); + assertNotNull(auditLogEntry); + } +} diff --git a/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/audit/ServerUtilTest.java b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/audit/ServerUtilTest.java new file mode 100644 index 0000000000..4f402f0667 --- /dev/null +++ b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/audit/ServerUtilTest.java @@ -0,0 +1,42 @@ +package io.mosip.commons.packet.test.audit; + +import static org.junit.Assert.assertNotNull; +import static org.mockito.Mockito.when; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.core.env.Environment; +import org.springframework.test.context.junit4.SpringRunner; + +import io.mosip.commons.packet.audit.ServerUtil; +import io.mosip.commons.packet.constants.PacketManagerConstants; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class ServerUtilTest { + + @Mock + private Environment environment; + + @Before + public void setup() { + when(environment.getProperty(PacketManagerConstants.AUDIT_HOST_NAME)).thenReturn("test-host"); + when(environment.getProperty(PacketManagerConstants.AUDIT_HOST_IP)).thenReturn("127.0.0.1"); + } + + @Test + public void testGetHostName() { + String hostName = ServerUtil.getHostName(); + assertNotNull(hostName); + } + + @Test + public void testGetHostIp() { + String hostIp = ServerUtil.getHostIp(); + assertNotNull(hostIp); + } +} diff --git a/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/ApiNotAccessibleExceptionTest.java b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/ApiNotAccessibleExceptionTest.java new file mode 100644 index 0000000000..ea8d84d552 --- /dev/null +++ b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/ApiNotAccessibleExceptionTest.java @@ -0,0 +1,27 @@ +package io.mosip.commons.packet.test.exception; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import io.mosip.commons.packet.exception.ApiNotAccessibleException; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class ApiNotAccessibleExceptionTest { + + @Test + public void testApiNotAccessibleException() { + ApiNotAccessibleException exception = new ApiNotAccessibleException("test-message"); + assertEquals("test-message", exception.getMessage()); + } + + @Test + public void testApiNotAccessibleExceptionWithCause() { + ApiNotAccessibleException exception = new ApiNotAccessibleException("test-message", new Throwable()); + assertEquals("test-message", exception.getMessage()); + } +} diff --git a/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/CryptoExceptionTest.java b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/CryptoExceptionTest.java new file mode 100644 index 0000000000..df1d6f3ca0 --- /dev/null +++ b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/CryptoExceptionTest.java @@ -0,0 +1,27 @@ +package io.mosip.commons.packet.test.exception; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import io.mosip.commons.packet.exception.CryptoException; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class CryptoExceptionTest { + + @Test + public void testCryptoException() { + CryptoException exception = new CryptoException("test-message"); + assertEquals("test-message", exception.getMessage()); + } + + @Test + public void testCryptoExceptionWithCause() { + CryptoException exception = new CryptoException("test-message", new Throwable()); + assertEquals("test-message", exception.getMessage()); + } +} diff --git a/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/FieldNameNotFoundExceptionTest.java b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/FieldNameNotFoundExceptionTest.java new file mode 100644 index 0000000000..4fb36805fc --- /dev/null +++ b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/FieldNameNotFoundExceptionTest.java @@ -0,0 +1,27 @@ +package io.mosip.commons.packet.test.exception; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import io.mosip.commons.packet.exception.FieldNameNotFoundException; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class FieldNameNotFoundExceptionTest { + + @Test + public void testFieldNameNotFoundException() { + FieldNameNotFoundException exception = new FieldNameNotFoundException("test-message"); + assertEquals("test-message", exception.getMessage()); + } + + @Test + public void testFieldNameNotFoundExceptionWithCause() { + FieldNameNotFoundException exception = new FieldNameNotFoundException("test-message", new Throwable()); + assertEquals("test-message", exception.getMessage()); + } +} diff --git a/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/FileNotFoundInDestinationExceptionTest.java b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/FileNotFoundInDestinationExceptionTest.java new file mode 100644 index 0000000000..7ec50b757d --- /dev/null +++ b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/FileNotFoundInDestinationExceptionTest.java @@ -0,0 +1,27 @@ +package io.mosip.commons.packet.test.exception; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import io.mosip.commons.packet.exception.FileNotFoundInDestinationException; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class FileNotFoundInDestinationExceptionTest { + + @Test + public void testFileNotFoundInDestinationException() { + FileNotFoundInDestinationException exception = new FileNotFoundInDestinationException("test-message"); + assertEquals("test-message", exception.getMessage()); + } + + @Test + public void testFileNotFoundInDestinationExceptionWithCause() { + FileNotFoundInDestinationException exception = new FileNotFoundInDestinationException("test-message", new Throwable()); + assertEquals("test-message", exception.getMessage()); + } +} diff --git a/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/GetAllIdentityExceptionTest.java b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/GetAllIdentityExceptionTest.java new file mode 100644 index 0000000000..3ff7dd595a --- /dev/null +++ b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/GetAllIdentityExceptionTest.java @@ -0,0 +1,27 @@ +package io.mosip.commons.packet.test.exception; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import io.mosip.commons.packet.exception.GetAllIdentityException; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class GetAllIdentityExceptionTest { + + @Test + public void testGetAllIdentityException() { + GetAllIdentityException exception = new GetAllIdentityException("test-message"); + assertEquals("test-message", exception.getMessage()); + } + + @Test + public void testGetAllIdentityExceptionWithCause() { + GetAllIdentityException exception = new GetAllIdentityException("test-message", new Throwable()); + assertEquals("test-message", exception.getMessage()); + } +} diff --git a/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/GetAllMetaInfoExceptionTest.java b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/GetAllMetaInfoExceptionTest.java new file mode 100644 index 0000000000..053b3114de --- /dev/null +++ b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/GetAllMetaInfoExceptionTest.java @@ -0,0 +1,27 @@ +package io.mosip.commons.packet.test.exception; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import io.mosip.commons.packet.exception.GetAllMetaInfoException; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class GetAllMetaInfoExceptionTest { + + @Test + public void testGetAllMetaInfoException() { + GetAllMetaInfoException exception = new GetAllMetaInfoException("test-message"); + assertEquals("test-message", exception.getMessage()); + } + + @Test + public void testGetAllMetaInfoExceptionWithCause() { + GetAllMetaInfoException exception = new GetAllMetaInfoException("test-message", new Throwable()); + assertEquals("test-message", exception.getMessage()); + } +} diff --git a/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/GetBiometricExceptionTest.java b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/GetBiometricExceptionTest.java new file mode 100644 index 0000000000..20e55d9c78 --- /dev/null +++ b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/GetBiometricExceptionTest.java @@ -0,0 +1,27 @@ +package io.mosip.commons.packet.test.exception; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import io.mosip.commons.packet.exception.GetBiometricException; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class GetBiometricExceptionTest { + + @Test + public void testGetBiometricException() { + GetBiometricException exception = new GetBiometricException("test-message"); + assertEquals("test-message", exception.getMessage()); + } + + @Test + public void testGetBiometricExceptionWithCause() { + GetBiometricException exception = new GetBiometricException("test-message", new Throwable()); + assertEquals("test-message", exception.getMessage()); + } +} diff --git a/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/GetDocumentExceptionTest.java b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/GetDocumentExceptionTest.java new file mode 100644 index 0000000000..057f5f33dd --- /dev/null +++ b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/GetDocumentExceptionTest.java @@ -0,0 +1,27 @@ +package io.mosip.commons.packet.test.exception; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import io.mosip.commons.packet.exception.GetDocumentException; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class GetDocumentExceptionTest { + + @Test + public void testGetDocumentException() { + GetDocumentException exception = new GetDocumentException("test-message"); + assertEquals("test-message", exception.getMessage()); + } + + @Test + public void testGetDocumentExceptionWithCause() { + GetDocumentException exception = new GetDocumentException("test-message", new Throwable()); + assertEquals("test-message", exception.getMessage()); + } +} diff --git a/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/GetTagExceptionTest.java b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/GetTagExceptionTest.java new file mode 100644 index 0000000000..a73e1e0eaf --- /dev/null +++ b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/GetTagExceptionTest.java @@ -0,0 +1,27 @@ +package io.mosip.commons.packet.test.exception; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import io.mosip.commons.packet.exception.GetTagException; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class GetTagExceptionTest { + + @Test + public void testGetTagException() { + GetTagException exception = new GetTagException("test-message"); + assertEquals("test-message", exception.getMessage()); + } + + @Test + public void testGetTagExceptionWithCause() { + GetTagException exception = new GetTagException("test-message", new Throwable()); + assertEquals("test-message", exception.getMessage()); + } +} diff --git a/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/NoAvailableProviderExceptionTest.java b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/NoAvailableProviderExceptionTest.java new file mode 100644 index 0000000000..a6df65203c --- /dev/null +++ b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/NoAvailableProviderExceptionTest.java @@ -0,0 +1,27 @@ +package io.mosip.commons.packet.test.exception; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import io.mosip.commons.packet.exception.NoAvailableProviderException; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class NoAvailableProviderExceptionTest { + + @Test + public void testNoAvailableProviderException() { + NoAvailableProviderException exception = new NoAvailableProviderException("test-message"); + assertEquals("test-message", exception.getMessage()); + } + + @Test + public void testNoAvailableProviderExceptionWithCause() { + NoAvailableProviderException exception = new NoAvailableProviderException("test-message", new Throwable()); + assertEquals("test-message", exception.getMessage()); + } +} diff --git a/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/ObjectDoesnotExistsExceptionTest.java b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/ObjectDoesnotExistsExceptionTest.java new file mode 100644 index 0000000000..a332fdc51a --- /dev/null +++ b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/ObjectDoesnotExistsExceptionTest.java @@ -0,0 +1,27 @@ +package io.mosip.commons.packet.test.exception; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import io.mosip.commons.packet.exception.ObjectDoesnotExistsException; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class ObjectDoesnotExistsExceptionTest { + + @Test + public void testObjectDoesnotExistsException() { + ObjectDoesnotExistsException exception = new ObjectDoesnotExistsException("test-message"); + assertEquals("test-message", exception.getMessage()); + } + + @Test + public void testObjectDoesnotExistsExceptionWithCause() { + ObjectDoesnotExistsException exception = new ObjectDoesnotExistsException("test-message", new Throwable()); + assertEquals("test-message", exception.getMessage()); + } +} diff --git a/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/ObjectStoreAdapterExceptionTest.java b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/ObjectStoreAdapterExceptionTest.java new file mode 100644 index 0000000000..a552090b30 --- /dev/null +++ b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/ObjectStoreAdapterExceptionTest.java @@ -0,0 +1,27 @@ +package io.mosip.commons.packet.test.exception; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import io.mosip.commons.packet.exception.ObjectStoreAdapterException; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class ObjectStoreAdapterExceptionTest { + + @Test + public void testObjectStoreAdapterException() { + ObjectStoreAdapterException exception = new ObjectStoreAdapterException("test-message"); + assertEquals("test-message", exception.getMessage()); + } + + @Test + public void testObjectStoreAdapterExceptionWithCause() { + ObjectStoreAdapterException exception = new ObjectStoreAdapterException("test-message", new Throwable()); + assertEquals("test-message", exception.getMessage()); + } +} diff --git a/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/PacketCreatorExceptionTest.java b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/PacketCreatorExceptionTest.java new file mode 100644 index 0000000000..f8db2eec62 --- /dev/null +++ b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/PacketCreatorExceptionTest.java @@ -0,0 +1,27 @@ +package io.mosip.commons.packet.test.exception; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import io.mosip.commons.packet.exception.PacketCreatorException; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class PacketCreatorExceptionTest { + + @Test + public void testPacketCreatorException() { + PacketCreatorException exception = new PacketCreatorException("test-message"); + assertEquals("test-message", exception.getMessage()); + } + + @Test + public void testPacketCreatorExceptionWithCause() { + PacketCreatorException exception = new PacketCreatorException("test-message", new Throwable()); + assertEquals("test-message", exception.getMessage()); + } +} diff --git a/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/PacketDecryptionFailureExceptionTest.java b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/PacketDecryptionFailureExceptionTest.java new file mode 100644 index 0000000000..4c9cf5f73c --- /dev/null +++ b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/PacketDecryptionFailureExceptionTest.java @@ -0,0 +1,27 @@ +package io.mosip.commons.packet.test.exception; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import io.mosip.commons.packet.exception.PacketDecryptionFailureException; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class PacketDecryptionFailureExceptionTest { + + @Test + public void testPacketDecryptionFailureException() { + PacketDecryptionFailureException exception = new PacketDecryptionFailureException("test-message"); + assertEquals("test-message", exception.getMessage()); + } + + @Test + public void testPacketDecryptionFailureExceptionWithCause() { + PacketDecryptionFailureException exception = new PacketDecryptionFailureException("test-message", new Throwable()); + assertEquals("test-message", exception.getMessage()); + } +} diff --git a/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/PacketIntegrityFailureExceptionTest.java b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/PacketIntegrityFailureExceptionTest.java new file mode 100644 index 0000000000..15d88d394a --- /dev/null +++ b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/PacketIntegrityFailureExceptionTest.java @@ -0,0 +1,27 @@ +package io.mosip.commons.packet.test.exception; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import io.mosip.commons.packet.exception.PacketIntegrityFailureException; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class PacketIntegrityFailureExceptionTest { + + @Test + public void testPacketIntegrityFailureException() { + PacketIntegrityFailureException exception = new PacketIntegrityFailureException("test-message"); + assertEquals("test-message", exception.getMessage()); + } + + @Test + public void testPacketIntegrityFailureExceptionWithCause() { + PacketIntegrityFailureException exception = new PacketIntegrityFailureException("test-message", new Throwable()); + assertEquals("test-message", exception.getMessage()); + } +} diff --git a/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/PacketKeeperExceptionTest.java b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/PacketKeeperExceptionTest.java new file mode 100644 index 0000000000..45816fde97 --- /dev/null +++ b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/PacketKeeperExceptionTest.java @@ -0,0 +1,27 @@ +package io.mosip.commons.packet.test.exception; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import io.mosip.commons.packet.exception.PacketKeeperException; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class PacketKeeperExceptionTest { + + @Test + public void testPacketKeeperException() { + PacketKeeperException exception = new PacketKeeperException("test-message"); + assertEquals("test-message", exception.getMessage()); + } + + @Test + public void testPacketKeeperExceptionWithCause() { + PacketKeeperException exception = new PacketKeeperException("test-message", new Throwable()); + assertEquals("test-message", exception.getMessage()); + } +} diff --git a/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/PacketReaderExceptionTest.java b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/PacketReaderExceptionTest.java new file mode 100644 index 0000000000..a5ac3d4e50 --- /dev/null +++ b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/PacketReaderExceptionTest.java @@ -0,0 +1,27 @@ +package io.mosip.commons.packet.test.exception; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import io.mosip.commons.packet.exception.PacketReaderException; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class PacketReaderExceptionTest { + + @Test + public void testPacketReaderException() { + PacketReaderException exception = new PacketReaderException("test-message"); + assertEquals("test-message", exception.getMessage()); + } + + @Test + public void testPacketReaderExceptionWithCause() { + PacketReaderException exception = new PacketReaderException("test-message", new Throwable()); + assertEquals("test-message", exception.getMessage()); + } +} diff --git a/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/PacketValidationFailureExceptionTest.java b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/PacketValidationFailureExceptionTest.java new file mode 100644 index 0000000000..29a269d81e --- /dev/null +++ b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/PacketValidationFailureExceptionTest.java @@ -0,0 +1,27 @@ +package io.mosip.commons.packet.test.exception; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import io.mosip.commons.packet.exception.PacketValidationFailureException; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class PacketValidationFailureExceptionTest { + + @Test + public void testPacketValidationFailureException() { + PacketValidationFailureException exception = new PacketValidationFailureException("test-message"); + assertEquals("test-message", exception.getMessage()); + } + + @Test + public void testPacketValidationFailureExceptionWithCause() { + PacketValidationFailureException exception = new PacketValidationFailureException("test-message", new Throwable()); + assertEquals("test-message", exception.getMessage()); + } +} diff --git a/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/SignatureExceptionTest.java b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/SignatureExceptionTest.java new file mode 100644 index 0000000000..95c871f6e4 --- /dev/null +++ b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/SignatureExceptionTest.java @@ -0,0 +1,27 @@ +package io.mosip.commons.packet.test.exception; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import io.mosip.commons.packet.exception.SignatureException; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class SignatureExceptionTest { + + @Test + public void testSignatureException() { + SignatureException exception = new SignatureException("test-message"); + assertEquals("test-message", exception.getMessage()); + } + + @Test + public void testSignatureExceptionWithCause() { + SignatureException exception = new SignatureException("test-message", new Throwable()); + assertEquals("test-message", exception.getMessage()); + } +} diff --git a/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/TagCreationExceptionTest.java b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/TagCreationExceptionTest.java new file mode 100644 index 0000000000..e81320ebd1 --- /dev/null +++ b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/TagCreationExceptionTest.java @@ -0,0 +1,27 @@ +package io.mosip.commons.packet.test.exception; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import io.mosip.commons.packet.exception.TagCreationException; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class TagCreationExceptionTest { + + @Test + public void testTagCreationException() { + TagCreationException exception = new TagCreationException("test-message"); + assertEquals("test-message", exception.getMessage()); + } + + @Test + public void testTagCreationExceptionWithCause() { + TagCreationException exception = new TagCreationException("test-message", new Throwable()); + assertEquals("test-message", exception.getMessage()); + } +} diff --git a/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/TagDeletionExceptionTest.java b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/TagDeletionExceptionTest.java new file mode 100644 index 0000000000..de97d388b2 --- /dev/null +++ b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/TagDeletionExceptionTest.java @@ -0,0 +1,27 @@ +package io.mosip.commons.packet.test.exception; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import io.mosip.commons.packet.exception.TagDeletionException; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class TagDeletionExceptionTest { + + @Test + public void testTagDeletionException() { + TagDeletionException exception = new TagDeletionException("test-message"); + assertEquals("test-message", exception.getMessage()); + } + + @Test + public void testTagDeletionExceptionWithCause() { + TagDeletionException exception = new TagDeletionException("test-message", new Throwable()); + assertEquals("test-message", exception.getMessage()); + } +} diff --git a/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/ZipParsingExceptionTest.java b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/ZipParsingExceptionTest.java new file mode 100644 index 0000000000..f813907a4d --- /dev/null +++ b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/exception/ZipParsingExceptionTest.java @@ -0,0 +1,27 @@ +package io.mosip.commons.packet.test.exception; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import io.mosip.commons.packet.exception.ZipParsingException; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class ZipParsingExceptionTest { + + @Test + public void testZipParsingException() { + ZipParsingException exception = new ZipParsingException("test-message"); + assertEquals("test-message", exception.getMessage()); + } + + @Test + public void testZipParsingExceptionWithCause() { + ZipParsingException exception = new ZipParsingException("test-message", new Throwable()); + assertEquals("test-message", exception.getMessage()); + } +} diff --git a/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/util/IdSchemaUtilsTest.java b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/util/IdSchemaUtilsTest.java new file mode 100644 index 0000000000..26c8936f22 --- /dev/null +++ b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/util/IdSchemaUtilsTest.java @@ -0,0 +1,84 @@ +package io.mosip.commons.packet.test.util; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.core.env.Environment; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.web.client.RestTemplate; + +import com.fasterxml.jackson.databind.ObjectMapper; + +import io.mosip.commons.packet.dto.packet.SimpleDto; +import io.mosip.commons.packet.exception.IdObjectIOException; +import io.mosip.commons.packet.exception.IdObjectValidationException; +import io.mosip.commons.packet.util.IdSchemaUtils; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class IdSchemaUtilsTest { + + @Mock + private RestTemplate restTemplate; + + @MockBean + private Environment environment; + + @Autowired + private IdSchemaUtils idSchemaUtils; + + @Before + public void setup() { + when(environment.getProperty(Mockito.anyString())).thenReturn("some-value"); + } + + @Test + public void testGetAllField() throws IOException, IdObjectIOException { + String schema = "{\"$schema\":\"http://json-schema.org/draft-07/schema#\",\"title\":\"Test\",\"description\":\"Test\",\"type\":\"object\",\"properties\":{\"identity\":{\"type\":\"object\",\"properties\":{\"test\":{\"type\":\"string\"}}}}}"; + List fieldNames = idSchemaUtils.getAllField(schema.getBytes()); + assertEquals(1, fieldNames.size()); + assertEquals("test", fieldNames.get(0)); + } + + @Test + public void testGetIdSchema() throws IOException { + String schema = "{\"$schema\":\"http://json-schema.org/draft-07/schema#\",\"title\":\"Test\",\"description\":\"Test\",\"type\":\"object\",\"properties\":{\"identity\":{\"type\":\"object\",\"properties\":{\"test\":{\"type\":\"string\"}}}}}"; + when(restTemplate.getForObject(Mockito.anyString(), Mockito.any())).thenReturn(schema); + Map idSchema = idSchemaUtils.getIdSchema("some-url"); + assertNotNull(idSchema); + } + + @Test + public void testValidate() throws IOException, IdObjectValidationException { + String schema = "{\"$schema\":\"http://json-schema.org/draft-07/schema#\",\"title\":\"Test\",\"description\":\"Test\",\"type\":\"object\",\"properties\":{\"identity\":{\"type\":\"object\",\"properties\":{\"test\":{\"type\":\"string\"}}}}}"; + List simpleDtoList = new ArrayList<>(); + SimpleDto simpleDto = new SimpleDto(); + simpleDto.setLanguage("eng"); + simpleDto.setValue("testValue"); + simpleDtoList.add(simpleDto); + ObjectMapper objectMapper = new ObjectMapper(); + String identity = objectMapper.writeValueAsString(simpleDtoList); + idSchemaUtils.validate(schema.getBytes(), identity); + } + + @Test + public void testIsIdSchemaValid() throws IOException { + String schema = "{\"$schema\":\"http://json-schema.org/draft-07/schema#\",\"title\":\"Test\",\"description\":\"Test\",\"type\":\"object\",\"properties\":{\"identity\":{\"type\":\"object\",\"properties\":{\"test\":{\"type\":\"string\"}}}}}"; + assertTrue(idSchemaUtils.isIdSchemaValid(schema.getBytes())); + } +} diff --git a/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/util/PacketManagerHelperTest.java b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/util/PacketManagerHelperTest.java new file mode 100644 index 0000000000..51bfcbd4fd --- /dev/null +++ b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/util/PacketManagerHelperTest.java @@ -0,0 +1,66 @@ +package io.mosip.commons.packet.test.util; + +import static org.junit.Assert.assertNotNull; +import static org.mockito.Mockito.when; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.core.env.Environment; +import org.springframework.test.context.junit4.SpringRunner; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ObjectNode; + +import io.mosip.commons.packet.constants.PacketManagerConstants; +import io.mosip.commons.packet.util.PacketManagerHelper; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class PacketManagerHelperTest { + + @Autowired + private PacketManagerHelper packetManagerHelper; + + @MockBean + private Environment environment; + + @Mock + private ObjectMapper objectMapper; + + @Before + public void setup() { + when(environment.getProperty(PacketManagerConstants.AUDIT_EVENT_NAME)).thenReturn("test-event"); + when(environment.getProperty(PacketManagerConstants.AUDIT_EVENT_TYPE)).thenReturn("test-type"); + when(environment.getProperty(PacketManagerConstants.AUDIT_APPLICATION_ID)).thenReturn("test-app-id"); + when(environment.getProperty(PacketManagerConstants.AUDIT_APPLICATION_NAME)).thenReturn("test-app-name"); + when(environment.getProperty(PacketManagerConstants.AUDIT_HOST_NAME)).thenReturn("test-host"); + when(environment.getProperty(PacketManagerConstants.AUDIT_HOST_IP)).thenReturn("127.0.0.1"); + } + + @Test + public void testGetPacketInfo() throws IOException { + Map resources = new HashMap<>(); + String json = "{\"key\":\"value\"}"; + resources.put("some-path", new ByteArrayInputStream(json.getBytes())); + ObjectNode objectNode = packetManagerHelper.getPacketInfo(resources); + assertNotNull(objectNode); + } + + @Test + public void testBuildAuditRequest() { + ObjectNode objectNode = packetManagerHelper.buildAuditRequest(null, "test-id", "test-name"); + assertNotNull(objectNode); + } +} diff --git a/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/util/PacketValidatorTest.java b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/util/PacketValidatorTest.java new file mode 100644 index 0000000000..10770ba2e9 --- /dev/null +++ b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/util/PacketValidatorTest.java @@ -0,0 +1,38 @@ +package io.mosip.commons.packet.test.util; + +import static org.junit.Assert.assertTrue; + +import java.util.HashSet; +import java.util.Set; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import io.mosip.commons.packet.exception.PacketValidationFailureException; +import io.mosip.commons.packet.util.PacketValidator; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class PacketValidatorTest { + + @Autowired + private PacketValidator packetValidator; + + @Test + public void testValidate() throws PacketValidationFailureException { + Set tags = new HashSet<>(); + tags.add("test-tag"); + packetValidator.validate(tags, "test-tag-to-validate"); + assertTrue(true); + } + + @Test(expected = PacketValidationFailureException.class) + public void testValidateFailure() throws PacketValidationFailureException { + Set tags = new HashSet<>(); + tags.add("test-tag"); + packetValidator.validate(tags, "invalid-tag"); + } +} diff --git a/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/util/ZipUtilsTest.java b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/util/ZipUtilsTest.java new file mode 100644 index 0000000000..c8a0384777 --- /dev/null +++ b/commons-packet/commons-packet-manager/src/test/java/io/mosip/commons/packet/test/util/ZipUtilsTest.java @@ -0,0 +1,36 @@ +package io.mosip.commons.packet.test.util; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.util.Map; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import io.mosip.commons.packet.exception.ZipParsingException; +import io.mosip.commons.packet.util.ZipUtils; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class ZipUtilsTest { + + @Test + public void testUnzip() throws IOException, ZipParsingException { + // Create a dummy zip file + byte[] zipData = new byte[] { 80, 75, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + Map unzippedFiles = ZipUtils.unzip(new ByteArrayInputStream(zipData)); + assertNotNull(unzippedFiles); + } + + @Test + public void testZip() throws IOException { + byte[] zipData = ZipUtils.zip(null); + assertNotNull(zipData); + assertTrue(zipData.length > 0); + } +} diff --git a/commons-packet/commons-packet-service/pom.xml b/commons-packet/commons-packet-service/pom.xml index e9d83f3d21..14c60eeb20 100644 --- a/commons-packet/commons-packet-service/pom.xml +++ b/commons-packet/commons-packet-service/pom.xml @@ -6,7 +6,7 @@ 4.0.0 io.mosip.commons commons-packet-service - 1.2.1-SNAPSHOT + 1.3.0-beta.2 commons-packet-service Mosip commons project https://github.com/mosip/commons @@ -20,28 +20,26 @@ 3.1.0 3.2.0 2.3 - 2.8.1 + 3.1.1 2.2.1 1.5 - 0.7.0 + 1.6.14 3.0.1 - 1.2.1-SNAPSHOT - 2.10.0 - - 1.2.1-SNAPSHOT - 1.2.1-SNAPSHOT - 1.2.1-SNAPSHOT - 1.2.1-SNAPSHOT - 1.2.1-SNAPSHOT - 1.2.1-SNAPSHOT - 1.2.1-SNAPSHOT - 1.2.1-SNAPSHOT + 2.9.2 + 1.3.0-beta.2 + 1.3.0-beta.1 + 1.3.0-beta.1 + 1.3.0-beta.2 + 1.3.0-beta.2 + 1.2.2-SNAPSHOT + 1.3.0-beta.2 **/constant/**,**/config/**,**/httpfilter/**,**/cache/**,**/dto/**,**/entity/**,**/model/**,**/exception/**,**/repository/**,**/security/**,**/*Config.java,**/*BootApplication.java,**/*VertxApplication.java,**/cbeffutil/**,**/*Utils.java,**/*Validator.java,**/*Helper.java,**/verticle/**,**/VidWriter.java/**,**/masterdata/utils/**,**/spi/**,**/core/http/**,"**/LocationServiceImpl.java","**/RegistrationCenterMachineServiceImpl.java","**/RegistrationCenterServiceImpl.java","**/pridgenerator/**","**/idgenerator/prid","**/proxy/**","**/cryptosignature/**" **/dto/**,**/entity/**,**/config/** - 1.2.1-SNAPSHOT + 1.3.0-beta.2 0.8.11 + 0.7.0 @@ -156,20 +154,25 @@ - - - maven-deploy-plugin - ${maven.deploy.plugin.version} - - - default-deploy - deploy - - deploy - - - - + + maven-deploy-plugin + ${maven.deploy.plugin.version} + + true + + + + default-deploy + none + + deploy + + + true + + + + org.sonatype.central central-publishing-maven-plugin @@ -180,7 +183,7 @@ false - + org.apache.maven.plugins maven-source-plugin true diff --git a/commons-packet/commons-packet-service/src/test/java/io/mosip/commons/packetmanager/test/controller/PacketManagerControllerTest.java b/commons-packet/commons-packet-service/src/test/java/io/mosip/commons/packetmanager/test/controller/PacketManagerControllerTest.java index 8daf396a52..2a7e709555 100644 --- a/commons-packet/commons-packet-service/src/test/java/io/mosip/commons/packetmanager/test/controller/PacketManagerControllerTest.java +++ b/commons-packet/commons-packet-service/src/test/java/io/mosip/commons/packetmanager/test/controller/PacketManagerControllerTest.java @@ -237,7 +237,6 @@ public void testValidatePacket() throws Exception { @Test @WithUserDetails("reg-processor") - @Ignore public void testCreatePacket() throws Exception { PacketDto packetDto = new PacketDto(); packetDto.setId("id"); @@ -249,14 +248,13 @@ public void testCreatePacket() throws Exception { request.setRequest(packetDto); - this.mockMvc.perform(put("/createPacket").contentType(MediaType.APPLICATION_JSON).content(JsonUtils.javaObjectToJsonString(request))) + this.mockMvc.perform(put("/create").contentType(MediaType.APPLICATION_JSON).content(JsonUtils.javaObjectToJsonString(request))) .andExpect(status().isOk()); } @Test @WithUserDetails("reg-processor") - @Ignore public void testBaseUncheckedException() throws Exception { PacketDto packetDto = new PacketDto(); packetDto.setId("id"); @@ -268,13 +266,12 @@ public void testBaseUncheckedException() throws Exception { request.setRequest(packetDto); - this.mockMvc.perform(put("/createPacket").contentType(MediaType.APPLICATION_JSON).content(JsonUtils.javaObjectToJsonString(request))) - .andExpect(status().isOk()); + this.mockMvc.perform(put("/create").contentType(MediaType.APPLICATION_JSON).content(JsonUtils.javaObjectToJsonString(request))) + .andExpect(status().is4xxClientError()); } @Test @WithUserDetails("reg-processor") - @Ignore public void testBaseCheckedException() throws Exception { InfoDto infoDto = new InfoDto(); infoDto.setBypassCache(false); @@ -282,7 +279,7 @@ public void testBaseCheckedException() throws Exception { infoDto.setProcess("NEW"); infoDto.setSource("REGISTRATION"); - Mockito.when(packetReaderService.getSourceAndProcess(any(),any(),any(),any())).thenReturn(new SourceProcessDto("source", "process")); + Mockito.when(packetReaderService.getSourceAndProcess(any(),any(),any())).thenReturn(new SourceProcessDto("source", "process")); Mockito.when( packetReader.getAudits(anyString(), anyString(), anyString(), anyBoolean())).thenThrow(new BaseCheckedException("errorCode", "errorMessage")); @@ -290,7 +287,7 @@ public void testBaseCheckedException() throws Exception { request.setRequest(infoDto); this.mockMvc.perform(post("/audits").contentType(MediaType.APPLICATION_JSON).content(JsonUtils.javaObjectToJsonString(request))) - .andExpect(status().isOk()); + .andExpect(status().is4xxClientError()); } @Test @WithUserDetails("reg-processor") diff --git a/commons-packet/commons-packet-service/src/test/java/io/mosip/commons/packetmanager/test/controller/PacketReaderControllerTest.java b/commons-packet/commons-packet-service/src/test/java/io/mosip/commons/packetmanager/test/controller/PacketReaderControllerTest.java new file mode 100644 index 0000000000..f88b44d433 --- /dev/null +++ b/commons-packet/commons-packet-service/src/test/java/io/mosip/commons/packetmanager/test/controller/PacketReaderControllerTest.java @@ -0,0 +1,254 @@ +package io.mosip.commons.packetmanager.test.controller; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.ArgumentMatchers.anyString; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import java.util.ArrayList; +import java.util.HashMap; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.http.MediaType; +import org.springframework.security.test.context.support.WithUserDetails; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.web.client.RestTemplate; + +import com.google.common.collect.Lists; + +import io.mosip.commons.packet.dto.Document; +import io.mosip.commons.packet.dto.TagRequestDto; +import io.mosip.commons.packet.dto.TagResponseDto; +import io.mosip.commons.packet.facade.PacketReader; +import io.mosip.commons.packetmanager.dto.BiometricRequestDto; +import io.mosip.commons.packetmanager.dto.DocumentDto; +import io.mosip.commons.packetmanager.dto.FieldDto; +import io.mosip.commons.packetmanager.dto.FieldDtos; +import io.mosip.commons.packetmanager.dto.InfoDto; +import io.mosip.commons.packetmanager.dto.InfoRequestDto; +import io.mosip.commons.packetmanager.dto.InfoResponseDto; +import io.mosip.commons.packetmanager.dto.SourceProcessDto; +import io.mosip.commons.packetmanager.service.PacketReaderService; +import io.mosip.commons.packetmanager.test.TestBootApplication; +import io.mosip.kernel.biometrics.entities.BiometricRecord; +import io.mosip.kernel.core.exception.BaseCheckedException; +import io.mosip.kernel.core.http.RequestWrapper; +import io.mosip.kernel.core.util.JsonUtils; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = TestBootApplication.class) +@AutoConfigureMockMvc +public class PacketReaderControllerTest { + + @MockBean + private RestTemplate restTemplate; + + @Autowired + private MockMvc mockMvc; + + @MockBean + private PacketReader packetReader; + + @MockBean + private PacketReaderService packetReaderService; + + private RequestWrapper request = new RequestWrapper<>(); + + @Before + public void setup() { + MockitoAnnotations.initMocks(this); + Mockito.when(packetReaderService.getSourceAndProcess(any(),any(),any(),any())).thenReturn(new SourceProcessDto("source", "process")); + Mockito.when(packetReaderService.getSourceAndProcess(any(),any(),any())).thenReturn(new SourceProcessDto("source", "process")); + } + + @Test + @WithUserDetails("reg-processor") + public void testSearchField() throws Exception { + String value = "value"; + FieldDto fieldDto = new FieldDto(); + fieldDto.setField("name"); + fieldDto.setBypassCache(false); + fieldDto.setId("id"); + fieldDto.setProcess("NEW"); + fieldDto.setSource("REGISTRATION"); + + Mockito.when( + packetReader.getField(anyString(), anyString(), anyString(), anyString(), anyBoolean())).thenReturn(value); + + request.setRequest(fieldDto); + + this.mockMvc.perform(post("/field").contentType(MediaType.APPLICATION_JSON).content(JsonUtils.javaObjectToJsonString(request))) + .andExpect(status().isOk()); + } + + @Test + @WithUserDetails("reg-processor") + public void testSearchFields() throws Exception { + FieldDtos fieldDto = new FieldDtos(); + fieldDto.setFields(Lists.newArrayList("fullname", "email")); + fieldDto.setBypassCache(false); + fieldDto.setId("id"); + fieldDto.setProcess("NEW"); + fieldDto.setSource("REGISTRATION"); + + Mockito.when( + packetReader.getFields(anyString(), any(), anyString(), anyString(), anyBoolean())).thenReturn(new HashMap<>()); + + request.setRequest(fieldDto); + + this.mockMvc.perform(post("/fields").contentType(MediaType.APPLICATION_JSON).content(JsonUtils.javaObjectToJsonString(request))) + .andExpect(status().isOk()); + } + + @Test + @WithUserDetails("reg-processor") + public void testDocument() throws Exception { + DocumentDto documentDto = new DocumentDto(); + documentDto.setDocumentName("document"); + documentDto.setId("id"); + documentDto.setProcess("NEW"); + documentDto.setSource("REGISTRATION"); + + Mockito.when( + packetReader.getDocument(anyString(), anyString(), anyString(), anyString())).thenReturn(new Document()); + + request.setRequest(documentDto); + + this.mockMvc.perform(post("/document").contentType(MediaType.APPLICATION_JSON).content(JsonUtils.javaObjectToJsonString(request))) + .andExpect(status().isOk()); + } + + @Test + @WithUserDetails("reg-processor") + public void testBiometrics() throws Exception { + BiometricRequestDto biometricRequestDto = new BiometricRequestDto(); + biometricRequestDto.setPerson("applicant"); + biometricRequestDto.setId("id"); + biometricRequestDto.setProcess("NEW"); + biometricRequestDto.setSource("REGISTRATION"); + + Mockito.when( + packetReader.getBiometric(anyString(), anyString(), any(), anyString(), anyString(), anyBoolean())).thenReturn(new BiometricRecord()); + + request.setRequest(biometricRequestDto); + + this.mockMvc.perform(post("/biometrics").contentType(MediaType.APPLICATION_JSON).content(JsonUtils.javaObjectToJsonString(request))) + .andExpect(status().isOk()); + } + + @Test + @WithUserDetails("reg-processor") + public void testMetaInfo() throws Exception { + InfoDto infoDto = new InfoDto(); + infoDto.setBypassCache(false); + infoDto.setId("id"); + infoDto.setProcess("NEW"); + infoDto.setSource("REGISTRATION"); + + Mockito.when( + packetReader.getMetaInfo(anyString(), anyString(), anyString(), anyBoolean())).thenReturn(new HashMap<>()); + + request.setRequest(infoDto); + + this.mockMvc.perform(post("/metainfo").contentType(MediaType.APPLICATION_JSON).content(JsonUtils.javaObjectToJsonString(request))) + .andExpect(status().isOk()); + } + + @Test + @WithUserDetails("reg-processor") + public void testAudits() throws Exception { + InfoDto infoDto = new InfoDto(); + infoDto.setBypassCache(false); + infoDto.setId("id"); + infoDto.setProcess("NEW"); + infoDto.setSource("REGISTRATION"); + + Mockito.when( + packetReader.getAudits(anyString(), anyString(), anyString(), anyBoolean())).thenReturn(new ArrayList<>()); + + request.setRequest(infoDto); + + this.mockMvc.perform(post("/audits").contentType(MediaType.APPLICATION_JSON).content(JsonUtils.javaObjectToJsonString(request))) + .andExpect(status().isOk()); + } + + @Test + @WithUserDetails("reg-processor") + public void testValidatePacket() throws Exception { + InfoDto infoDto = new InfoDto(); + infoDto.setBypassCache(false); + infoDto.setId("id"); + infoDto.setProcess("NEW"); + infoDto.setSource("REGISTRATION"); + + Mockito.when( + packetReader.validatePacket(anyString(), anyString(), anyString())).thenReturn(true); + + request.setRequest(infoDto); + + this.mockMvc.perform(post("/validate").contentType(MediaType.APPLICATION_JSON).content(JsonUtils.javaObjectToJsonString(request))) + .andExpect(status().isOk()); + } + + @Test + @WithUserDetails("reg-processor") + public void testBaseCheckedException() throws Exception { + InfoDto infoDto = new InfoDto(); + infoDto.setBypassCache(false); + infoDto.setId("id"); + infoDto.setProcess("NEW"); + infoDto.setSource("REGISTRATION"); + + Mockito.when( + packetReader.getAudits(anyString(), anyString(), anyString(), anyBoolean())).thenThrow(new BaseCheckedException("errorCode", "errorMessage")); + + request.setRequest(infoDto); + + this.mockMvc.perform(post("/audits").contentType(MediaType.APPLICATION_JSON).content(JsonUtils.javaObjectToJsonString(request))) + .andExpect(status().is4xxClientError()); + } + + @Test + @WithUserDetails("reg-processor") + public void testGetTags() throws Exception { + TagRequestDto tagDto = new TagRequestDto(); + tagDto.setId("id"); + + Mockito.when( + packetReaderService.getTags(any())).thenReturn(new TagResponseDto()); + + request.setRequest(tagDto); + + this.mockMvc.perform(post("/tags").contentType(MediaType.APPLICATION_JSON).content(JsonUtils.javaObjectToJsonString(request))) + .andExpect(status().isOk()); + } + + @Test + @WithUserDetails("reg-processor") + public void testInfo() throws Exception { + InfoRequestDto infoDto = new InfoRequestDto(); + infoDto.setId("id"); + + InfoResponseDto infoResponseDto = new InfoResponseDto(); + infoResponseDto.setPacketId(infoDto.getId()); + infoResponseDto.setApplicationId(infoDto.getId()); + + Mockito.when( + packetReaderService.info(anyString())).thenReturn(infoResponseDto); + + request.setRequest(infoDto); + + this.mockMvc.perform(post("/info").contentType(MediaType.APPLICATION_JSON).content(JsonUtils.javaObjectToJsonString(request))) + .andExpect(status().isOk()); + } +} diff --git a/commons-packet/commons-packet-service/src/test/java/io/mosip/commons/packetmanager/test/controller/PacketWriterControllerTest.java b/commons-packet/commons-packet-service/src/test/java/io/mosip/commons/packetmanager/test/controller/PacketWriterControllerTest.java new file mode 100644 index 0000000000..b23b2c6e97 --- /dev/null +++ b/commons-packet/commons-packet-service/src/test/java/io/mosip/commons/packetmanager/test/controller/PacketWriterControllerTest.java @@ -0,0 +1,144 @@ +package io.mosip.commons.packetmanager.test.controller; + +import static org.mockito.ArgumentMatchers.any; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.http.MediaType; +import org.springframework.security.test.context.support.WithUserDetails; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.web.client.RestTemplate; + +import io.mosip.commons.packet.dto.TagDeleteResponseDto; +import io.mosip.commons.packet.dto.TagDto; +import io.mosip.commons.packet.dto.TagRequestDto; +import io.mosip.commons.packet.dto.TagResponseDto; +import io.mosip.commons.packet.dto.packet.PacketDto; +import io.mosip.commons.packet.facade.PacketWriter; +import io.mosip.commons.packetmanager.service.PacketWriterService; +import io.mosip.commons.packetmanager.test.TestBootApplication; +import io.mosip.kernel.core.exception.BaseUncheckedException; +import io.mosip.kernel.core.http.RequestWrapper; +import io.mosip.kernel.core.util.JsonUtils; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = TestBootApplication.class) +@AutoConfigureMockMvc +public class PacketWriterControllerTest { + + @MockBean + private RestTemplate restTemplate; + + @Autowired + private MockMvc mockMvc; + + @MockBean + private PacketWriter packetWriter; + + @MockBean + private PacketWriterService packetWriterService; + + private RequestWrapper request = new RequestWrapper<>(); + + @Before + public void setup() { + MockitoAnnotations.initMocks(this); + } + + @Test + @WithUserDetails("reg-processor") + public void testCreatePacket() throws Exception { + PacketDto packetDto = new PacketDto(); + packetDto.setId("id"); + packetDto.setProcess("NEW"); + packetDto.setSource("REGISTRATION"); + + Mockito.when( + packetWriter.createPacket(any())).thenReturn(new ArrayList<>()); + + request.setRequest(packetDto); + + this.mockMvc.perform(put("/create").contentType(MediaType.APPLICATION_JSON).content(JsonUtils.javaObjectToJsonString(request))) + .andExpect(status().isOk()); + } + + @Test + @WithUserDetails("reg-processor") + public void testBaseUncheckedException() throws Exception { + PacketDto packetDto = new PacketDto(); + packetDto.setId("id"); + packetDto.setProcess("NEW"); + packetDto.setSource("REGISTRATION"); + + Mockito.when( + packetWriter.createPacket(any())).thenThrow(new BaseUncheckedException("errorCode", "errorMessage")); + + request.setRequest(packetDto); + + this.mockMvc.perform(put("/create").contentType(MediaType.APPLICATION_JSON).content(JsonUtils.javaObjectToJsonString(request))) + .andExpect(status().is4xxClientError()); + } + + @Test + @WithUserDetails("reg-processor") + public void testAddTag() throws Exception { + TagDto tagDto = new TagDto(); + tagDto.setId("id"); + + Mockito.when( + packetWriterService.addTags(any())).thenReturn(new TagResponseDto()); + + request.setRequest(tagDto); + + this.mockMvc.perform(post("/tags").contentType(MediaType.APPLICATION_JSON).content(JsonUtils.javaObjectToJsonString(request))) + .andExpect(status().isOk()); + } + @Test + @WithUserDetails("reg-processor") + public void testUpdateTags() throws Exception { + TagDto tagDto = new TagDto(); + tagDto.setId("id"); + + Mockito.when( + packetWriterService.updateTags(any())).thenReturn(new TagResponseDto()); + + request.setRequest(tagDto); + + this.mockMvc.perform(put("/tags").contentType(MediaType.APPLICATION_JSON).content(JsonUtils.javaObjectToJsonString(request))) + .andExpect(status().isOk()); + } + + @Test + @WithUserDetails("reg-processor") + public void testDeleteTags() throws Exception { + TagRequestDto tagRequestDto = new TagRequestDto(); + tagRequestDto.setId("id"); + List tagNames=new ArrayList<>(); + tagNames.add("osivalidation"); + tagRequestDto.setTagNames(tagNames); + TagDeleteResponseDto tagResponse=new TagDeleteResponseDto(); + tagResponse.setStatus("Deleted Successfully"); + Mockito.when( + packetWriterService.deleteTags(any())).thenReturn(tagResponse); + + request.setRequest(tagRequestDto); + + this.mockMvc.perform(delete("/tags").contentType(MediaType.APPLICATION_JSON).content(JsonUtils.javaObjectToJsonString(request))) + .andExpect(status().isOk()); + } +} diff --git a/commons-packet/commons-packet-service/src/test/java/io/mosip/commons/packetmanager/test/exception/SourceNotPresentExceptionTest.java b/commons-packet/commons-packet-service/src/test/java/io/mosip/commons/packetmanager/test/exception/SourceNotPresentExceptionTest.java new file mode 100644 index 0000000000..ea35ff8c78 --- /dev/null +++ b/commons-packet/commons-packet-service/src/test/java/io/mosip/commons/packetmanager/test/exception/SourceNotPresentExceptionTest.java @@ -0,0 +1,27 @@ +package io.mosip.commons.packetmanager.test.exception; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import io.mosip.commons.packetmanager.exception.SourceNotPresentException; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class SourceNotPresentExceptionTest { + + @Test + public void testSourceNotPresentException() { + SourceNotPresentException exception = new SourceNotPresentException("test-message"); + assertEquals("test-message", exception.getMessage()); + } + + @Test + public void testSourceNotPresentExceptionWithCause() { + SourceNotPresentException exception = new SourceNotPresentException("test-message", new Throwable()); + assertEquals("test-message", exception.getMessage()); + } +} diff --git a/commons-packet/commons-packet-service/src/test/java/io/mosip/commons/packetmanager/test/service/PacketReaderServiceTest.java b/commons-packet/commons-packet-service/src/test/java/io/mosip/commons/packetmanager/test/service/PacketReaderServiceTest.java index e8967af9f5..4af9577b8f 100644 --- a/commons-packet/commons-packet-service/src/test/java/io/mosip/commons/packetmanager/test/service/PacketReaderServiceTest.java +++ b/commons-packet/commons-packet-service/src/test/java/io/mosip/commons/packetmanager/test/service/PacketReaderServiceTest.java @@ -165,4 +165,31 @@ public void testGetTagsException() { tagRequestDto.setTagNames(tagNames); packetReaderService.getTags(tagRequestDto); } + + @Test + public void testGetBiometric() throws Exception { + BiometricRecord biometricRecord = packetReaderService.getBiometric("id", "source", "process", "type", null, false); + assertEquals(1, biometricRecord.getSegments().size()); + } + + @Test + public void testGetDocument() throws Exception { + Mockito.when(packetReader.getDocument(anyString(), anyString(), anyString(), anyString(), anyBoolean())).thenReturn("test".getBytes()); + byte[] document = packetReaderService.getDocument("id", "source", "process", "type", false); + assertEquals("test", new String(document)); + } + + @Test + public void testGetAll() throws Exception { + Mockito.when(packetReader.getAll(anyString(), anyString(), anyString(), anyBoolean())).thenReturn("test".getBytes()); + byte[] all = packetReaderService.getAll("id", "source", "process", false); + assertEquals("test", new String(all)); + } + + @Test + public void testGetAllMeta() throws Exception { + Mockito.when(packetReader.getAllMeta(anyString(), anyString(), anyString(), anyBoolean())).thenReturn("test".getBytes()); + byte[] allMeta = packetReaderService.getAllMeta("id", "source", "process", false); + assertEquals("test", new String(allMeta)); + } } diff --git a/commons-packet/commons-packet-service/src/test/java/io/mosip/commons/packetmanager/test/service/PacketWriterServiceTest.java b/commons-packet/commons-packet-service/src/test/java/io/mosip/commons/packetmanager/test/service/PacketWriterServiceTest.java index b48d24f62e..72e16ee7a4 100644 --- a/commons-packet/commons-packet-service/src/test/java/io/mosip/commons/packetmanager/test/service/PacketWriterServiceTest.java +++ b/commons-packet/commons-packet-service/src/test/java/io/mosip/commons/packetmanager/test/service/PacketWriterServiceTest.java @@ -1,128 +1,138 @@ -package io.mosip.commons.packetmanager.test.service; - -import static org.junit.Assert.assertEquals; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyString; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.springframework.test.context.junit4.SpringRunner; - -import io.mosip.commons.packet.dto.TagDto; -import io.mosip.commons.packet.dto.TagRequestDto; -import io.mosip.commons.packet.dto.TagResponseDto; -import io.mosip.commons.packet.exception.TagCreationException; -import io.mosip.commons.packet.exception.TagDeletionException; -import io.mosip.commons.packet.facade.PacketReader; -import io.mosip.commons.packet.facade.PacketWriter; -import io.mosip.commons.packetmanager.service.PacketWriterService; -import io.mosip.kernel.core.exception.BaseUncheckedException; - -@RunWith(SpringRunner.class) -public class PacketWriterServiceTest { - @Mock - private PacketReader packetReader; - - @Mock - private PacketWriter packetWriter; - - @InjectMocks - private PacketWriterService packetWriterService; - - @Before - public void setup() { - Map tags = new HashMap<>(); - tags.put("test", "testValue"); - Mockito.when(packetReader.getTags(anyString())).thenReturn(tags); - - } - - @Test - public void testAddTagsSuccess() { - TagDto tagDto=new TagDto(); - tagDto.setId("id"); - Map tags = new HashMap<>(); - tags.put("testtag", "testValue"); - tagDto.setTags(tags); - Mockito.when(packetWriter.addTags(any(),anyString())).thenReturn(tags); - TagResponseDto tagResponseDto= packetWriterService.addTags(tagDto); - assertEquals(tagResponseDto.getTags(), tags); - } - @Test(expected = TagCreationException.class) - public void testTagAlreadyExists() { - TagDto tagDto = new TagDto(); - tagDto.setId("id"); - Map tags = new HashMap<>(); - tags.put("test", "testValue"); - tagDto.setTags(tags); - Mockito.when(packetWriter.addTags(any(),anyString())).thenReturn(tags); - packetWriterService.addTags(tagDto); - } - - @Test(expected = TagCreationException.class) - public void testAddTagsException() { - TagDto tagDto = new TagDto(); - tagDto.setId("id"); - Map tags = new HashMap<>(); - tags.put("testtag", "testValue"); - tagDto.setTags(tags); - Mockito.when(packetWriter.addTags(any(),anyString())).thenThrow(new BaseUncheckedException("code", "message")); - packetWriterService.addTags(tagDto); - } - - @Test - public void testUpdateTagsSuccess() { - TagDto tagDto = new TagDto(); - tagDto.setId("id"); - Map tags = new HashMap<>(); - tags.put("test", "testValueChanges"); - tagDto.setTags(tags); - Mockito.when(packetWriter.addTags(any(),anyString())).thenReturn(tags); - TagResponseDto tagResponseDto = packetWriterService.updateTags(tagDto); - assertEquals(tagResponseDto.getTags(), tags); - } - - @Test(expected = TagCreationException.class) - public void testUpdateTagsException() { - TagDto tagDto = new TagDto(); - tagDto.setId("id"); - Map tags = new HashMap<>(); - tags.put("testtag", "testValue"); - tagDto.setTags(tags); - Mockito.when(packetWriter.addTags(any(),anyString())).thenThrow(new BaseUncheckedException("code", "message")); - packetWriterService.updateTags(tagDto); - } - - @Test - public void testDeleteTagsSuccess() { - TagRequestDto tagRequestDto = new TagRequestDto(); - tagRequestDto.setId("id"); - List tagNames = new ArrayList(); - tagNames.add("test"); - tagRequestDto.setTagNames(tagNames); - packetWriterService.deleteTags(tagRequestDto); - - } - - @Test(expected = TagDeletionException.class) - public void testDeleteTagsException() { - TagRequestDto tagRequestDto = new TagRequestDto(); - tagRequestDto.setId("id"); - List tagNames = new ArrayList(); - tagNames.add("test"); - tagRequestDto.setTagNames(tagNames); - Mockito.doThrow(new BaseUncheckedException("code", "message")).when(packetWriter).deleteTags(any(),anyString()); - - packetWriterService.deleteTags(tagRequestDto); - - } -} +package io.mosip.commons.packetmanager.test.service; + +import static org.junit.Assert.assertEquals; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.springframework.test.context.junit4.SpringRunner; + +import io.mosip.commons.packet.dto.TagDto; +import io.mosip.commons.packet.dto.TagRequestDto; +import io.mosip.commons.packet.dto.TagResponseDto; +import io.mosip.commons.packet.exception.TagCreationException; +import io.mosip.commons.packet.exception.TagDeletionException; +import io.mosip.commons.packet.facade.PacketReader; +import io.mosip.commons.packet.facade.PacketWriter; +import io.mosip.commons.packetmanager.service.PacketWriterService; +import io.mosip.kernel.core.exception.BaseUncheckedException; + +@RunWith(SpringRunner.class) +public class PacketWriterServiceTest { + @Mock + private PacketReader packetReader; + + @Mock + private PacketWriter packetWriter; + + @InjectMocks + private PacketWriterService packetWriterService; + + @Before + public void setup() { + Map tags = new HashMap<>(); + tags.put("test", "testValue"); + Mockito.when(packetReader.getTags(anyString())).thenReturn(tags); + + } + + @Test + public void testAddTagsSuccess() { + TagDto tagDto=new TagDto(); + tagDto.setId("id"); + Map tags = new HashMap<>(); + tags.put("testtag", "testValue"); + tagDto.setTags(tags); + Mockito.when(packetWriter.addTags(any(),anyString())).thenReturn(tags); + TagResponseDto tagResponseDto= packetWriterService.addTags(tagDto); + assertEquals(tagResponseDto.getTags(), tags); + } + @Test(expected = TagCreationException.class) + public void testTagAlreadyExists() { + TagDto tagDto = new TagDto(); + tagDto.setId("id"); + Map tags = new HashMap<>(); + tags.put("test", "testValue"); + tagDto.setTags(tags); + Mockito.when(packetWriter.addTags(any(),anyString())).thenReturn(tags); + packetWriterService.addTags(tagDto); + } + + @Test(expected = TagCreationException.class) + public void testAddTagsException() { + TagDto tagDto = new TagDto(); + tagDto.setId("id"); + Map tags = new HashMap<>(); + tags.put("testtag", "testValue"); + tagDto.setTags(tags); + Mockito.when(packetWriter.addTags(any(),anyString())).thenThrow(new BaseUncheckedException("code", "message")); + packetWriterService.addTags(tagDto); + } + + @Test + public void testUpdateTagsSuccess() { + TagDto tagDto = new TagDto(); + tagDto.setId("id"); + Map tags = new HashMap<>(); + tags.put("test", "testValueChanges"); + tagDto.setTags(tags); + Mockito.when(packetWriter.addTags(any(),anyString())).thenReturn(tags); + TagResponseDto tagResponseDto = packetWriterService.updateTags(tagDto); + assertEquals(tagResponseDto.getTags(), tags); + } + + @Test(expected = TagCreationException.class) + public void testUpdateTagsException() { + TagDto tagDto = new TagDto(); + tagDto.setId("id"); + Map tags = new HashMap<>(); + tags.put("testtag", "testValue"); + tagDto.setTags(tags); + Mockito.when(packetWriter.addTags(any(),anyString())).thenThrow(new BaseUncheckedException("code", "message")); + packetWriterService.updateTags(tagDto); + } + + @Test + public void testDeleteTagsSuccess() { + TagRequestDto tagRequestDto = new TagRequestDto(); + tagRequestDto.setId("id"); + List tagNames = new ArrayList(); + tagNames.add("test"); + tagRequestDto.setTagNames(tagNames); + packetWriterService.deleteTags(tagRequestDto); + + } + + @Test(expected = TagDeletionException.class) + public void testDeleteTagsException() { + TagRequestDto tagRequestDto = new TagRequestDto(); + tagRequestDto.setId("id"); + List tagNames = new ArrayList(); + tagNames.add("test"); + tagRequestDto.setTagNames(tagNames); + Mockito.doThrow(new BaseUncheckedException("code", "message")).when(packetWriter).deleteTags(any(),anyString()); + + packetWriterService.deleteTags(tagRequestDto); + + } + + @Test(expected = TagDeletionException.class) + public void testDeleteTagNotFound() { + TagRequestDto tagRequestDto = new TagRequestDto(); + tagRequestDto.setId("id"); + List tagNames = new ArrayList(); + tagNames.add("testtag"); + tagRequestDto.setTagNames(tagNames); + packetWriterService.deleteTags(tagRequestDto); + } +} diff --git a/commons-packet/pom.xml b/commons-packet/pom.xml index b66c723b6d..2ce645be8e 100644 --- a/commons-packet/pom.xml +++ b/commons-packet/pom.xml @@ -7,7 +7,7 @@ io.mosip.commons commons-packet - 1.2.1-SNAPSHOT + 1.3.0-beta.2 common-packet Common packet manager for MOSIP https://github.com/mosip/packet-manager @@ -31,7 +31,7 @@ 2.2.1 1.5 0.7.0 - 3.0.1 + 3.0.1 **/constant/**,**/config/**,**/httpfilter/**,**/cache/**,**/dto/**,**/entity/**,**/model/**,**/exception/**,**/repository/**,**/security/**,**/*Config.java,**/*BootApplication.java,**/*VertxApplication.java,**/cbeffutil/**,**/*Utils.java,**/*Validator.java,**/*Helper.java,**/verticle/**,**/VidWriter.java/**,**/masterdata/utils/**,**/spi/**,**/core/http/**,"**/LocationServiceImpl.java","**/RegistrationCenterMachineServiceImpl.java","**/RegistrationCenterServiceImpl.java","**/pridgenerator/**","**/idgenerator/prid","**/proxy/**","**/cryptosignature/**" **/dto/**,**/entity/**,**/config/** @@ -51,7 +51,7 @@ https://central.sonatype.com/api/v1/publisher - + @@ -128,30 +128,7 @@ ${maven.compiler.target} - - maven-deploy-plugin - ${maven.deploy.plugin.version} - - - default-deploy - deploy - - deploy - - - - - org.sonatype.central - central-publishing-maven-plugin - ${central.publishing.maven.plugin.version} - true - - ossrh - false - - - org.apache.maven.plugins maven-source-plugin true @@ -165,7 +142,16 @@ - + + org.sonatype.central + central-publishing-maven-plugin + ${central.publishing.maven.plugin.version} + true + + ossrh + false + + org.apache.maven.plugins maven-javadoc-plugin diff --git a/deploy/install.sh b/deploy/install.sh index 2a0f3f9924..2381aa8cfe 100755 --- a/deploy/install.sh +++ b/deploy/install.sh @@ -7,7 +7,7 @@ if [ $# -ge 1 ] ; then fi NS=packetmanager -CHART_VERSION=0.0.1-develop +CHART_VERSION=1.3.0-beta.2 echo Create $NS namespace kubectl create ns $NS diff --git a/helm/packetmanager/Chart.yaml b/helm/packetmanager/Chart.yaml index e41dc30b51..5819d51287 100644 --- a/helm/packetmanager/Chart.yaml +++ b/helm/packetmanager/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: packetmanager description: A Helm chart for MOSIP Packetmanager module type: application -version: 0.0.1-develop +version: 1.3.0-beta.2 appVersion: "" dependencies: - name: common diff --git a/helm/packetmanager/values.yaml b/helm/packetmanager/values.yaml index 601befe4f3..b6b5f1df41 100644 --- a/helm/packetmanager/values.yaml +++ b/helm/packetmanager/values.yaml @@ -12,23 +12,18 @@ ## commonLabels: app.kubernetes.io/component: mosip - ## Add annotations to all the deployed resources ## commonAnnotations: {} - ## Kubernetes Cluster Domain ## clusterDomain: cluster.local - ## Extra objects to deploy (value evaluated as a template) ## extraDeploy: [] - ## Number of nodes ## replicaCount: 1 - service: type: ClusterIP port: 80 @@ -49,11 +44,10 @@ service: ## ref http://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip ## externalTrafficPolicy: Cluster - image: registry: docker.io - repository: mosipqa/commons-packet-service - tag: develop + repository: mosipid/commons-packet-service + tag: 1.3.0-beta.2 ## Specify a imagePullPolicy ## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent' ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images @@ -65,10 +59,8 @@ image: ## # pullSecrets: # - myRegistryKeySecretName - ## Port on which this particular spring service module is running. springServicePort: 8093 - ## Configure extra options for liveness and readiness probes ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes ## @@ -82,7 +74,6 @@ startupProbe: timeoutSeconds: 5 failureThreshold: 30 successThreshold: 1 - livenessProbe: enabled: true httpGet: @@ -93,7 +84,6 @@ livenessProbe: timeoutSeconds: 5 failureThreshold: 6 successThreshold: 1 - readinessProbe: enabled: true httpGet: @@ -104,7 +94,6 @@ readinessProbe: timeoutSeconds: 5 failureThreshold: 6 successThreshold: 1 - ## # existingConfigmap: @@ -112,12 +101,10 @@ readinessProbe: ## command: [] args: [] - ## Deployment pod host aliases ## https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/ ## hostAliases: [] - ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ ## resources: @@ -136,32 +123,27 @@ additionalResources: ## Specify any JAVA_OPTS string here. These typically will be specified in conjunction with above resources ## Example: java_opts: "-Xms500M -Xmx500M" javaOpts: "-Xms4000M -Xmx4000M" - ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container ## Clamav container already runs as 'mosip' user, so we may not need to enable this containerSecurityContext: enabled: false runAsUser: mosip runAsNonRoot: true - ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod ## podSecurityContext: enabled: false fsGroup: 1001 - ## Pod affinity preset ## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity ## Allowed values: soft, hard ## podAffinityPreset: "" - ## Pod anti-affinity preset ## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity ## Allowed values: soft, hard ## podAntiAffinityPreset: soft - ## Node affinity preset ## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity ## Allowed values: soft, hard @@ -183,32 +165,26 @@ nodeAffinityPreset: ## - e2e-az2 ## values: [] - ## Affinity for pod assignment. Evaluated as a template. ## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity ## affinity: {} - ## Node labels for pod assignment. Evaluated as a template. ## ref: https://kubernetes.io/docs/user-guide/node-selection/ ## nodeSelector: {} - ## Tolerations for pod assignment. Evaluated as a template. ## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ ## tolerations: [] - ## Pod extra labels ## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ ## podLabels: {} - ## Annotations for server pods. ## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ ## podAnnotations: {} - ## pods' priority. ## ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ ## @@ -217,15 +193,12 @@ podAnnotations: {} ## lifecycleHooks for the container to automate configuration before or after startup. ## lifecycleHooks: {} - ## Custom Liveness probes for ## customLivenessProbe: {} - ## Custom Rediness probes ## customReadinessProbe: {} - ## Update strategy - only really applicable for deployments with RWO PVs attached ## If replicas = 1, an update can get "stuck", as the previous pod remains attached to the ## PV, and the "incoming" pod can never start. Changing the strategy to "Recreate" will @@ -233,7 +206,6 @@ customReadinessProbe: {} ## updateStrategy: type: RollingUpdate - ## Additional environment variables to set ## Example: ## extraEnvVars: @@ -241,14 +213,12 @@ updateStrategy: ## value: "bar" ## extraEnvVars: [] - ## ConfigMap with extra environment variables that used ## extraEnvVarsCM: - global - config-server-share - artifactory-share - ## Secret with extra environment variables ## extraEnvVarsSecret: [] @@ -256,11 +226,9 @@ extraEnvVarsSecret: [] ## Extra volumes to add to the deployment ## extraVolumes: [] - ## Extra volume mounts to add to the container ## extraVolumeMounts: [] - ## Add init containers to the pods. ## Example: ## initContainers: @@ -272,7 +240,6 @@ extraVolumeMounts: [] ## containerPort: 1234 ## initContainers: {} - ## Add sidecars to the pods. ## Example: ## sidecars: @@ -284,7 +251,6 @@ initContainers: {} ## containerPort: 1234 ## sidecars: {} - persistence: enabled: false ## If defined, storageClassName: @@ -306,7 +272,6 @@ persistence: existingClaim: # Dir where config and keys are written inside container mountDir: - ## Init containers parameters: ## volumePermissions: Change the owner and group of the persistent volume mountpoint to runAsUser:fsGroup values from the securityContext section. ## @@ -340,12 +305,10 @@ volumePermissions: ## cpu: 100m ## memory: 128Mi ## - ## Specifies whether RBAC resources should be created ## rbac: create: true - ## Specifies whether a ServiceAccount should be created ## serviceAccount: @@ -354,7 +317,6 @@ serviceAccount: ## If not set and create is true, a name is generated using the fullname template ## name: - ## Prometheus Metrics ## metrics: @@ -364,9 +326,7 @@ metrics: ## podAnnotations: prometheus.io/scrape: "true" - endpointPath: /commons/v1/packetmanager/actuator/prometheus - ## Prometheus Service Monitor ## ref: https://github.com/coreos/prometheus-operator ## @@ -393,7 +353,6 @@ metrics: ## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#prometheusspec ## additionalLabels: {} - ## Custom PrometheusRule to be defined ## The value is evaluated as a template, so, for example, the value can depend on .Release or .Chart ## ref: https://github.com/coreos/prometheus-operator#customresourcedefinitions @@ -411,7 +370,6 @@ metrics: # labels: # severity: error rules: [] - ## Only internal access istio: enabled: true