@SuppressWarnings("unchecked") @Test public void testSubmitPolicies_Throws_SpiritAdapterException() throws SpiritAdapterException, EhrException_Exception { List<byte[]> policyListMock = Arrays.asList(new byte[1]); when(webService.submitPolicies(any(EhrPolicySubmitRq.class))) .thenThrow(EhrException_Exception.class); thrown.expect(SpiritAdapterException.class); @SuppressWarnings("unused") EhrPolicySubmitRsp actualResponse = sat.submitPolicies(policyListMock); }
@Override public EhrPolicySubmitRsp submitPolicies(List<byte[]> policyList) throws SpiritAdapterException { Assert.notEmpty(policyList, "'policyList' cannot be empty."); logger.debug("submitPolicies: START"); EhrPolicySubmitRsp ehrPolicySubmitRsp = null; try { String stateId = login(); EhrPolicySubmitRq ehrPolicySubmitRq = new EhrPolicySubmitRq(); ehrPolicySubmitRq.setStateID(stateId); ehrPolicySubmitRq.getPolicyList().addAll(policyList); ehrPolicySubmitRsp = getWebService().submitPolicies( ehrPolicySubmitRq); logger.debug("submitPolicies: SUCCESS"); logout(stateId); } catch (Exception e) { logger.error("submitPolicies: FAILED", e); throw new SpiritAdapterException(e); } return ehrPolicySubmitRsp; }
SpiritAdapterImpl implements SpiritAdapter { @Override public EhrPolicySubmitRsp submitPolicies(List<byte[]> policyList) throws SpiritAdapterException { Assert.notEmpty(policyList, "'policyList' cannot be empty."); logger.debug("submitPolicies: START"); EhrPolicySubmitRsp ehrPolicySubmitRsp = null; try { String stateId = login(); EhrPolicySubmitRq ehrPolicySubmitRq = new EhrPolicySubmitRq(); ehrPolicySubmitRq.setStateID(stateId); ehrPolicySubmitRq.getPolicyList().addAll(policyList); ehrPolicySubmitRsp = getWebService().submitPolicies( ehrPolicySubmitRq); logger.debug("submitPolicies: SUCCESS"); logout(stateId); } catch (Exception e) { logger.error("submitPolicies: FAILED", e); throw new SpiritAdapterException(e); } return ehrPolicySubmitRsp; } }
SpiritAdapterImpl implements SpiritAdapter { @Override public EhrPolicySubmitRsp submitPolicies(List<byte[]> policyList) throws SpiritAdapterException { Assert.notEmpty(policyList, "'policyList' cannot be empty."); logger.debug("submitPolicies: START"); EhrPolicySubmitRsp ehrPolicySubmitRsp = null; try { String stateId = login(); EhrPolicySubmitRq ehrPolicySubmitRq = new EhrPolicySubmitRq(); ehrPolicySubmitRq.setStateID(stateId); ehrPolicySubmitRq.getPolicyList().addAll(policyList); ehrPolicySubmitRsp = getWebService().submitPolicies( ehrPolicySubmitRq); logger.debug("submitPolicies: SUCCESS"); logout(stateId); } catch (Exception e) { logger.error("submitPolicies: FAILED", e); throw new SpiritAdapterException(e); } return ehrPolicySubmitRsp; } SpiritAdapterImpl(String endpointUrl, String org, String pwd,
			String rol, String user, String domainId, String c2sDomainId,
			String c2sDomainType, String c2sEnvType);  SpiritAdapterImpl(String endpointUrl, String org, String pwd,
			String rol, String user, String domainId, String c2sDomainId,
			String c2sDomainType, String c2sEnvType,
			SpiritEhrWsClientRqRspInterface webService); }
SpiritAdapterImpl implements SpiritAdapter { @Override public EhrPolicySubmitRsp submitPolicies(List<byte[]> policyList) throws SpiritAdapterException { Assert.notEmpty(policyList, "'policyList' cannot be empty."); logger.debug("submitPolicies: START"); EhrPolicySubmitRsp ehrPolicySubmitRsp = null; try { String stateId = login(); EhrPolicySubmitRq ehrPolicySubmitRq = new EhrPolicySubmitRq(); ehrPolicySubmitRq.setStateID(stateId); ehrPolicySubmitRq.getPolicyList().addAll(policyList); ehrPolicySubmitRsp = getWebService().submitPolicies( ehrPolicySubmitRq); logger.debug("submitPolicies: SUCCESS"); logout(stateId); } catch (Exception e) { logger.error("submitPolicies: FAILED", e); throw new SpiritAdapterException(e); } return ehrPolicySubmitRsp; } SpiritAdapterImpl(String endpointUrl, String org, String pwd,
			String rol, String user, String domainId, String c2sDomainId,
			String c2sDomainType, String c2sEnvType);  SpiritAdapterImpl(String endpointUrl, String org, String pwd,
			String rol, String user, String domainId, String c2sDomainId,
			String c2sDomainType, String c2sEnvType,
			SpiritEhrWsClientRqRspInterface webService); @Override SpiritUserResponse usrOrgRoleLogin(); @Override String login(); @Override void logout(String stateId); @Override PatientDto createPatientByPDQ(PatientDto patientDto); @Override PatientDto updatePatientByLocId(PatientDto patientDto); @Override XdsSrcSubmitRsp submitSignedConsent(byte[] xacmlPolicy,
			byte[] signedConsentPdf, byte[] pdfConsentFromXacml,
			byte[] pdfConsentToXacml, String xacmlPolicyId, String patientId,
			String country); @Override EhrPatientClientListDto queryPatientsWithPids(String patientId,
			String stateId); EhrPatientRsp insertPatient(EhrPatientRq arg0); @Override XdsSrcSubmitRsp submitDocument(EhrPatientClientDto submitForPatient,
			SourceSubmissionClientDto sourceSubmission, Boolean withFolder,
			String stateId); @Override XdsSrcSubmitRsp submitDocument(EhrPatientClientDto submitForPatient,
			SourceSubmissionClientDto sourceSubmission, Boolean withFolder); @Override EhrXdsQRsp queryPatientContent(EhrPatientClientDto patient,
			String stateId); @Override EhrXdsRetrRsp retrieveDocument(DocumentClientDto wantedDocument); @Override EhrPatientClientDto updateDocument(
			XdsSrcUpdateReq xdsSrcUpdateRequest); @Override SourceSubmissionClientDto generatePolicyMetadata(String document); @Override DocumentClientDto queryDocumentsByUid(String patientId,
			String documentUniqueId, String stateId); @Override XdsSrcSubmitRsp deprecateDocument(String documentUniqueId,
			String patientId, String stateId); @Override XdsSrcSubmitRsp deprecateDocuments(
			List<String> documentUniqueIdList, String patientId, String stateId); @Override XdsSrcSubmitRsp deprecateDocuments(
			List<String> documentUniqueIdList, EhrPatientClientDto patient,
			PatientContentClientDto patientContentClientDto, String stateId); @Override String deleteDocuments(FolderClientDto folder,
			List<DocumentClientDto> documentList, EhrPatientClientDto patient,
			String stateId); @Override XdsSrcSubmitRsp deleteDocument(FolderClientDto folder,
			DocumentClientDto document, EhrPatientClientDto patient,
			String stateId); @Override XdsSrcSubmitRsp deprecatePolicy(String documentUniqueId,
			String patientId, byte[] revokedPdfConsent); XdsSrcSubmitRsp appendDocument(EhrPatientClientDto patient,
			DocumentClientDto oldDocument, DocumentClientDto documentToAppend,
			String stateId); @Override EhrPolicySubmitRsp submitPolicy(byte[] policy); @Override EhrPolicySubmitRsp submitPolicies(List<byte[]> policyList); @Override EhrPolicySubmitOrUpdateRsp submitOrUpdatePolicy(byte[] policy,
			String stateId); @Override EhrPolicySubmitOrUpdateRsp submitOrUpdatePolicies(
			List<byte[]> policyList, String stateId); @Override EhrPolicyUpdateRsp updatePolicy(byte[] policy); @Override EhrPolicyUpdateRsp updatePolicies(List<byte[]> policyList); @Override byte[] retrievePolicy(String policyId); @Override List<byte[]> retrievePolicies(List<String> listPolicySetIds,
			List<String> listPolicyIds); @Override EhrPolicyDiscardRsp discardPolicy(String policyId, String stateId); @Override EhrPolicyDiscardRsp discardPolicies(List<String> listPolicySetIds,
			List<String> listPolicyIds, String stateId); EhrPapCfgRsp loadPapConfiguration(); @Override XdsSrcSubmitRsp submitC32(byte[] c32file); @Override SourceSubmissionClientDto generateC32Metadata(String document); }
SpiritAdapterImpl implements SpiritAdapter { @Override public EhrPolicySubmitRsp submitPolicies(List<byte[]> policyList) throws SpiritAdapterException { Assert.notEmpty(policyList, "'policyList' cannot be empty."); logger.debug("submitPolicies: START"); EhrPolicySubmitRsp ehrPolicySubmitRsp = null; try { String stateId = login(); EhrPolicySubmitRq ehrPolicySubmitRq = new EhrPolicySubmitRq(); ehrPolicySubmitRq.setStateID(stateId); ehrPolicySubmitRq.getPolicyList().addAll(policyList); ehrPolicySubmitRsp = getWebService().submitPolicies( ehrPolicySubmitRq); logger.debug("submitPolicies: SUCCESS"); logout(stateId); } catch (Exception e) { logger.error("submitPolicies: FAILED", e); throw new SpiritAdapterException(e); } return ehrPolicySubmitRsp; } SpiritAdapterImpl(String endpointUrl, String org, String pwd,
			String rol, String user, String domainId, String c2sDomainId,
			String c2sDomainType, String c2sEnvType);  SpiritAdapterImpl(String endpointUrl, String org, String pwd,
			String rol, String user, String domainId, String c2sDomainId,
			String c2sDomainType, String c2sEnvType,
			SpiritEhrWsClientRqRspInterface webService); @Override SpiritUserResponse usrOrgRoleLogin(); @Override String login(); @Override void logout(String stateId); @Override PatientDto createPatientByPDQ(PatientDto patientDto); @Override PatientDto updatePatientByLocId(PatientDto patientDto); @Override XdsSrcSubmitRsp submitSignedConsent(byte[] xacmlPolicy,
			byte[] signedConsentPdf, byte[] pdfConsentFromXacml,
			byte[] pdfConsentToXacml, String xacmlPolicyId, String patientId,
			String country); @Override EhrPatientClientListDto queryPatientsWithPids(String patientId,
			String stateId); EhrPatientRsp insertPatient(EhrPatientRq arg0); @Override XdsSrcSubmitRsp submitDocument(EhrPatientClientDto submitForPatient,
			SourceSubmissionClientDto sourceSubmission, Boolean withFolder,
			String stateId); @Override XdsSrcSubmitRsp submitDocument(EhrPatientClientDto submitForPatient,
			SourceSubmissionClientDto sourceSubmission, Boolean withFolder); @Override EhrXdsQRsp queryPatientContent(EhrPatientClientDto patient,
			String stateId); @Override EhrXdsRetrRsp retrieveDocument(DocumentClientDto wantedDocument); @Override EhrPatientClientDto updateDocument(
			XdsSrcUpdateReq xdsSrcUpdateRequest); @Override SourceSubmissionClientDto generatePolicyMetadata(String document); @Override DocumentClientDto queryDocumentsByUid(String patientId,
			String documentUniqueId, String stateId); @Override XdsSrcSubmitRsp deprecateDocument(String documentUniqueId,
			String patientId, String stateId); @Override XdsSrcSubmitRsp deprecateDocuments(
			List<String> documentUniqueIdList, String patientId, String stateId); @Override XdsSrcSubmitRsp deprecateDocuments(
			List<String> documentUniqueIdList, EhrPatientClientDto patient,
			PatientContentClientDto patientContentClientDto, String stateId); @Override String deleteDocuments(FolderClientDto folder,
			List<DocumentClientDto> documentList, EhrPatientClientDto patient,
			String stateId); @Override XdsSrcSubmitRsp deleteDocument(FolderClientDto folder,
			DocumentClientDto document, EhrPatientClientDto patient,
			String stateId); @Override XdsSrcSubmitRsp deprecatePolicy(String documentUniqueId,
			String patientId, byte[] revokedPdfConsent); XdsSrcSubmitRsp appendDocument(EhrPatientClientDto patient,
			DocumentClientDto oldDocument, DocumentClientDto documentToAppend,
			String stateId); @Override EhrPolicySubmitRsp submitPolicy(byte[] policy); @Override EhrPolicySubmitRsp submitPolicies(List<byte[]> policyList); @Override EhrPolicySubmitOrUpdateRsp submitOrUpdatePolicy(byte[] policy,
			String stateId); @Override EhrPolicySubmitOrUpdateRsp submitOrUpdatePolicies(
			List<byte[]> policyList, String stateId); @Override EhrPolicyUpdateRsp updatePolicy(byte[] policy); @Override EhrPolicyUpdateRsp updatePolicies(List<byte[]> policyList); @Override byte[] retrievePolicy(String policyId); @Override List<byte[]> retrievePolicies(List<String> listPolicySetIds,
			List<String> listPolicyIds); @Override EhrPolicyDiscardRsp discardPolicy(String policyId, String stateId); @Override EhrPolicyDiscardRsp discardPolicies(List<String> listPolicySetIds,
			List<String> listPolicyIds, String stateId); EhrPapCfgRsp loadPapConfiguration(); @Override XdsSrcSubmitRsp submitC32(byte[] c32file); @Override SourceSubmissionClientDto generateC32Metadata(String document);  }