@Test public void testCreateDoc() { int[] value = new int[] { 2, 6 }; when(jdbcTemplate.batchUpdate(any(String.class), any(List.class))).thenReturn(value); marriageCertRepository.createDoc(getReissueCertRequest()); }
public void createDoc(ReissueCertRequest reissueAppRequest){ List<MarriageDocument> documents=reissueAppRequest.getReissueApplication().getDocuments(); jdbcTemplate.batchUpdate(Docs_insert_Query, new BatchPreparedStatementSetter() { @Override public void setValues(PreparedStatement ps, int index) throws SQLException { MarriageDocument mrDoc=documents.get(index); ps.setString(1,mrDoc.getId()); ps.setString(2, reissueAppRequest.getReissueApplication().getId()); ps.setString(3, mrDoc.getDocumentType()); ps.setString(4, mrDoc.getLocation()); ps.setString(5, reissueAppRequest.getRequestInfo().getDid()); ps.setLong (6, new Date().getTime()); ps.setString(7, reissueAppRequest.getRequestInfo().getDid()); ps.setLong (8, new Date().getTime()); ps.setString(9, mrDoc.getTenantId()); } @Override public int getBatchSize() { return documents.size(); } }); }
MarriageCertRepository { public void createDoc(ReissueCertRequest reissueAppRequest){ List<MarriageDocument> documents=reissueAppRequest.getReissueApplication().getDocuments(); jdbcTemplate.batchUpdate(Docs_insert_Query, new BatchPreparedStatementSetter() { @Override public void setValues(PreparedStatement ps, int index) throws SQLException { MarriageDocument mrDoc=documents.get(index); ps.setString(1,mrDoc.getId()); ps.setString(2, reissueAppRequest.getReissueApplication().getId()); ps.setString(3, mrDoc.getDocumentType()); ps.setString(4, mrDoc.getLocation()); ps.setString(5, reissueAppRequest.getRequestInfo().getDid()); ps.setLong (6, new Date().getTime()); ps.setString(7, reissueAppRequest.getRequestInfo().getDid()); ps.setLong (8, new Date().getTime()); ps.setString(9, mrDoc.getTenantId()); } @Override public int getBatchSize() { return documents.size(); } }); } }
MarriageCertRepository { public void createDoc(ReissueCertRequest reissueAppRequest){ List<MarriageDocument> documents=reissueAppRequest.getReissueApplication().getDocuments(); jdbcTemplate.batchUpdate(Docs_insert_Query, new BatchPreparedStatementSetter() { @Override public void setValues(PreparedStatement ps, int index) throws SQLException { MarriageDocument mrDoc=documents.get(index); ps.setString(1,mrDoc.getId()); ps.setString(2, reissueAppRequest.getReissueApplication().getId()); ps.setString(3, mrDoc.getDocumentType()); ps.setString(4, mrDoc.getLocation()); ps.setString(5, reissueAppRequest.getRequestInfo().getDid()); ps.setLong (6, new Date().getTime()); ps.setString(7, reissueAppRequest.getRequestInfo().getDid()); ps.setLong (8, new Date().getTime()); ps.setString(9, mrDoc.getTenantId()); } @Override public int getBatchSize() { return documents.size(); } }); }  }
MarriageCertRepository { public void createDoc(ReissueCertRequest reissueAppRequest){ List<MarriageDocument> documents=reissueAppRequest.getReissueApplication().getDocuments(); jdbcTemplate.batchUpdate(Docs_insert_Query, new BatchPreparedStatementSetter() { @Override public void setValues(PreparedStatement ps, int index) throws SQLException { MarriageDocument mrDoc=documents.get(index); ps.setString(1,mrDoc.getId()); ps.setString(2, reissueAppRequest.getReissueApplication().getId()); ps.setString(3, mrDoc.getDocumentType()); ps.setString(4, mrDoc.getLocation()); ps.setString(5, reissueAppRequest.getRequestInfo().getDid()); ps.setLong (6, new Date().getTime()); ps.setString(7, reissueAppRequest.getRequestInfo().getDid()); ps.setLong (8, new Date().getTime()); ps.setString(9, mrDoc.getTenantId()); } @Override public int getBatchSize() { return documents.size(); } }); }  void insert(MarriageRegn marriageRegn); List<ReissueCertAppl> findForCriteria(MarriageCertCriteria marriageCertCriteria); void createDoc(ReissueCertRequest reissueAppRequest); void updateDoc(ReissueCertRequest reissueAppRequest); void createReissue(ReissueCertRequest reissueAppRequest); void updateReissue(ReissueCertRequest reissueAppRequest); void createCert(ReissueCertAppl reissueApp); }
MarriageCertRepository { public void createDoc(ReissueCertRequest reissueAppRequest){ List<MarriageDocument> documents=reissueAppRequest.getReissueApplication().getDocuments(); jdbcTemplate.batchUpdate(Docs_insert_Query, new BatchPreparedStatementSetter() { @Override public void setValues(PreparedStatement ps, int index) throws SQLException { MarriageDocument mrDoc=documents.get(index); ps.setString(1,mrDoc.getId()); ps.setString(2, reissueAppRequest.getReissueApplication().getId()); ps.setString(3, mrDoc.getDocumentType()); ps.setString(4, mrDoc.getLocation()); ps.setString(5, reissueAppRequest.getRequestInfo().getDid()); ps.setLong (6, new Date().getTime()); ps.setString(7, reissueAppRequest.getRequestInfo().getDid()); ps.setLong (8, new Date().getTime()); ps.setString(9, mrDoc.getTenantId()); } @Override public int getBatchSize() { return documents.size(); } }); }  void insert(MarriageRegn marriageRegn); List<ReissueCertAppl> findForCriteria(MarriageCertCriteria marriageCertCriteria); void createDoc(ReissueCertRequest reissueAppRequest); void updateDoc(ReissueCertRequest reissueAppRequest); void createReissue(ReissueCertRequest reissueAppRequest); void updateReissue(ReissueCertRequest reissueAppRequest); void createCert(ReissueCertAppl reissueApp); static final String CERTIFICATE_INSERT_QUERY; final String GET_APPLICATION_NO_QUERY; final String create_Certificate_Query; }