Skip to content

Commit b03636c

Browse files
Merge branch 'release-1.3.x' into release-1.3.x
2 parents e81cd05 + 6bbb7f9 commit b03636c

File tree

105 files changed

+7107
-2257
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+7107
-2257
lines changed

.github/workflows/push-trigger.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
secrets:
4444
OSSRH_USER: ${{ secrets.OSSRH_USER }}
4545
OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }}
46-
OSSRH_URL: ${{ secrets.OSSRH_SNAPSHOT_URL }}
46+
OSSRH_URL: ${{ secrets.RELEASE_URL }}
4747
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
4848
GPG_SECRET: ${{ secrets.GPG_SECRET }}
4949
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
@@ -114,7 +114,7 @@ jobs:
114114
secrets:
115115
OSSRH_USER: ${{ secrets.OSSRH_USER }}
116116
OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }}
117-
OSSRH_URL: ${{ secrets.OSSRH_SNAPSHOT_URL }}
117+
OSSRH_URL: ${{ secrets.RELEASE_URL }}
118118
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
119119
GPG_SECRET: ${{ secrets.GPG_SECRET }}
120120
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

admin/admin-service/pom.xml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
<maven.surefire.plugin.version>2.22.0</maven.surefire.plugin.version>
3232
<mosip.biometric.util.version>1.3.0-beta.1</mosip.biometric.util.version>
3333
<mosip.openid.bridge.version>1.3.0-beta.1</mosip.openid.bridge.version>
34+
<maven.deploy.plugin.version>3.1.1</maven.deploy.plugin.version>
35+
<nexus.staging.maven.plugin.version>1.6.14</nexus.staging.maven.plugin.version>
3436
</properties>
3537
<dependencyManagement>
3638
<dependencies>
@@ -372,6 +374,45 @@
372374
<skip>false</skip>
373375
</configuration>
374376
</plugin>
377+
<plugin>
378+
<artifactId>maven-deploy-plugin</artifactId>
379+
<version>${maven.deploy.plugin.version}</version>
380+
<configuration>
381+
<skip>true</skip>
382+
</configuration>
383+
<executions>
384+
<execution>
385+
<id>default-deploy</id>
386+
<phase>none</phase>
387+
<goals>
388+
<goal>deploy</goal>
389+
</goals>
390+
<configuration>
391+
<skip>true</skip>
392+
</configuration>
393+
</execution>
394+
</executions>
395+
</plugin>
396+
<plugin>
397+
<groupId>org.sonatype.plugins</groupId>
398+
<artifactId>nexus-staging-maven-plugin</artifactId>
399+
<version>${nexus.staging.maven.plugin.version}</version>
400+
<extensions>true</extensions>
401+
<executions>
402+
<execution>
403+
<id>default-deploy</id>
404+
<phase>none</phase>
405+
<goals>
406+
<goal>deploy</goal>
407+
</goals>
408+
</execution>
409+
</executions>
410+
<configuration>
411+
<serverId>ossrh</serverId>
412+
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
413+
<autoReleaseAfterClose>false</autoReleaseAfterClose>
414+
</configuration>
415+
</plugin>
375416
</plugins>
376417
</build>
377418
</profile>

admin/admin-service/src/main/java/io/mosip/admin/packetstatusupdater/util/RestClient.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,12 @@ public <T> T getApi(String url,
203203
try {
204204
ResponseEntity responseEntity= restTemplate
205205
.exchange(url, HttpMethod.GET, setRequestHeader(null, null), responseType);
206-
if(url != null && url.contains("datashare") && responseEntity != null && responseEntity.getHeaders() != null &&
207-
responseEntity.getHeaders().getContentType().equals(MediaType.APPLICATION_JSON)){
208-
throw new MasterDataServiceException(ApplicantDetailErrorCode.DATA_SHARE_EXPIRED_EXCEPTION.getErrorCode(),
209-
ApplicantDetailErrorCode.DATA_SHARE_EXPIRED_EXCEPTION.getErrorMessage());
206+
if (url != null && url.contains("datashare") && responseEntity != null) {
207+
MediaType contentType = responseEntity.getHeaders().getContentType();
208+
if (contentType != null && contentType.equals(MediaType.APPLICATION_JSON)){
209+
throw new MasterDataServiceException(ApplicantDetailErrorCode.DATA_SHARE_EXPIRED_EXCEPTION.getErrorCode(),
210+
ApplicantDetailErrorCode.DATA_SHARE_EXPIRED_EXCEPTION.getErrorMessage());
211+
}
210212
}
211213
result= (T) responseEntity.getBody();
212214
} catch (Exception e) {
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
package io.mosip.admin.bulkdataupload.batch;
2+
3+
import org.junit.Test;
4+
import org.junit.runner.RunWith;
5+
import org.mockito.junit.MockitoJUnitRunner;
6+
import org.springframework.batch.extensions.excel.support.rowset.RowSet;
7+
import org.springframework.beans.NotWritablePropertyException;
8+
import org.springframework.boot.convert.ApplicationConversionService;
9+
import org.springframework.boot.test.context.SpringBootTest;
10+
import org.springframework.boot.web.reactive.context.AnnotationConfigReactiveWebApplicationContext;
11+
import org.springframework.format.support.DefaultFormattingConversionService;
12+
import org.springframework.validation.BindException;
13+
import org.springframework.validation.DataBinder;
14+
import org.springframework.validation.DefaultBindingErrorProcessor;
15+
import org.springframework.validation.beanvalidation.CustomValidatorBean;
16+
17+
import javax.validation.ConstraintViolationException;
18+
import java.util.HashSet;
19+
import java.util.Properties;
20+
21+
import static org.junit.Assert.*;
22+
import static org.mockito.Mockito.mock;
23+
import static org.mockito.Mockito.when;
24+
25+
@SpringBootTest
26+
@RunWith(MockitoJUnitRunner.class)
27+
public class CustomExcelRowMapperTest {
28+
29+
@Test
30+
public void createBinder_withApplicationConversionService_returnSuccessResponse() {
31+
ApplicationConversionService conversionService = new ApplicationConversionService();
32+
DataBinder actualCreateBinderResult = (new CustomExcelRowMapper<>(conversionService, new CustomValidatorBean()))
33+
.createBinder("Target");
34+
35+
assertNotNull(actualCreateBinderResult);
36+
assertFalse(actualCreateBinderResult.isIgnoreUnknownFields());
37+
assertFalse(actualCreateBinderResult.isIgnoreInvalidFields());
38+
assertTrue(actualCreateBinderResult.isAutoGrowNestedPaths());
39+
assertNull(actualCreateBinderResult.getValidator());
40+
assertEquals("Target", actualCreateBinderResult.getTarget());
41+
assertEquals("target", actualCreateBinderResult.getObjectName());
42+
assertTrue(actualCreateBinderResult.getBindingErrorProcessor() instanceof DefaultBindingErrorProcessor);
43+
assertEquals(256, actualCreateBinderResult.getAutoGrowCollectionLimit());
44+
}
45+
46+
@Test
47+
public void createBinder_withDefaultFormattingConversionService_returnSuccessResponse() {
48+
DefaultFormattingConversionService conversionService = new DefaultFormattingConversionService();
49+
50+
DataBinder actualCreateBinderResult = (new CustomExcelRowMapper<>(conversionService, new CustomValidatorBean()))
51+
.createBinder("Target");
52+
53+
assertNotNull(actualCreateBinderResult);
54+
assertFalse(actualCreateBinderResult.isIgnoreUnknownFields());
55+
assertFalse(actualCreateBinderResult.isIgnoreInvalidFields());
56+
assertTrue(actualCreateBinderResult.isAutoGrowNestedPaths());
57+
assertNull(actualCreateBinderResult.getValidator());
58+
assertEquals("Target", actualCreateBinderResult.getTarget());
59+
assertEquals("target", actualCreateBinderResult.getObjectName());
60+
assertTrue(actualCreateBinderResult.getBindingErrorProcessor() instanceof DefaultBindingErrorProcessor);
61+
assertEquals(256, actualCreateBinderResult.getAutoGrowCollectionLimit());
62+
}
63+
64+
@Test
65+
public void customExcelRowMapper_withSetValues_returnSuccessResponse() {
66+
ApplicationConversionService conversionService = new ApplicationConversionService();
67+
CustomExcelRowMapper<Object> actualCustomExcelRowMapper = new CustomExcelRowMapper<>(conversionService,
68+
new CustomValidatorBean());
69+
actualCustomExcelRowMapper.setBeanFactory(new AnnotationConfigReactiveWebApplicationContext());
70+
actualCustomExcelRowMapper.setDistanceLimit(1);
71+
actualCustomExcelRowMapper.setPrototypeBeanName("Name");
72+
actualCustomExcelRowMapper.setStrict(true);
73+
actualCustomExcelRowMapper.setTargetType(Object.class);
74+
DataBinder dataBinder = new DataBinder("Target", "Object Name");
75+
actualCustomExcelRowMapper.initBinder(dataBinder);
76+
assertNotNull(dataBinder);
77+
}
78+
79+
@Test
80+
public void customExcelRowMapper_withInitBinder_returnSuccessResponse() {
81+
ApplicationConversionService conversionService = new ApplicationConversionService();
82+
CustomExcelRowMapper<Object> actualCustomExcelRowMapper = new CustomExcelRowMapper<>(conversionService,
83+
new CustomValidatorBean());
84+
DataBinder dataBinder = new DataBinder("Target", "Object Name");
85+
actualCustomExcelRowMapper.initBinder(dataBinder);
86+
assertNotNull(dataBinder);
87+
}
88+
89+
@Test(expected = Exception.class)
90+
public void mapRow_withEmptyRowSet_throwException() throws BindException {
91+
ApplicationConversionService conversionService = new ApplicationConversionService();
92+
CustomExcelRowMapper<Object> customExcelRowMapper = new CustomExcelRowMapper<>(conversionService,
93+
new CustomValidatorBean());
94+
customExcelRowMapper.setTargetType(Object.class);
95+
RowSet rowSet = mock(RowSet.class);
96+
when(rowSet.getProperties()).thenReturn(new Properties());
97+
customExcelRowMapper.mapRow(rowSet);
98+
}
99+
100+
@Test(expected = NotWritablePropertyException.class)
101+
public void mapRow_withProperties_throwNotWritablePropertyException() throws BindException {
102+
ApplicationConversionService conversionService = new ApplicationConversionService();
103+
CustomExcelRowMapper<Object> customExcelRowMapper = new CustomExcelRowMapper<>(conversionService,
104+
new CustomValidatorBean());
105+
customExcelRowMapper.setTargetType(Object.class);
106+
107+
Properties properties = new Properties();
108+
properties.setProperty("key", "value");
109+
RowSet rowSet = mock(RowSet.class);
110+
when(rowSet.getProperties()).thenReturn(properties);
111+
customExcelRowMapper.mapRow(rowSet);
112+
}
113+
114+
@Test(expected = ConstraintViolationException.class)
115+
public void mapRow_withConstraintViolation_throwConstraintViolationException() throws BindException {
116+
ApplicationConversionService conversionService = new ApplicationConversionService();
117+
CustomExcelRowMapper<Object> customExcelRowMapper = new CustomExcelRowMapper<>(conversionService,
118+
new CustomValidatorBean());
119+
customExcelRowMapper.setTargetType(Object.class);
120+
RowSet rowSet = mock(RowSet.class);
121+
when(rowSet.getProperties()).thenThrow(new ConstraintViolationException(new HashSet<>()));
122+
customExcelRowMapper.mapRow(rowSet);
123+
124+
}
125+
126+
}

0 commit comments

Comments
 (0)