Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BAH-4090 | Refactor. Upgrade dependencies for release #275

Merged
merged 2 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.bahmni.module.bahmnicore.model.VideoFormats;
import org.bahmni.module.bahmnicore.properties.BahmniCoreProperties;
import org.bahmni.module.bahmnicore.service.ThumbnailGenerator;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
Expand All @@ -15,10 +16,13 @@
import org.mockito.Matchers;
import org.mockito.Mock;
import org.openmrs.Patient;
import org.openmrs.api.context.UserContext;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.springframework.http.ResponseEntity;
import org.openmrs.api.AdministrationService;
import org.openmrs.api.context.Context;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
Expand All @@ -39,9 +43,10 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.powermock.api.mockito.PowerMockito.verifyStatic;
import static org.mockito.MockitoAnnotations.initMocks;

@RunWith(PowerMockRunner.class)
@PrepareForTest({BahmniCoreProperties.class, FileInputStream.class, FileUtils.class, ImageIO.class})
@PrepareForTest({BahmniCoreProperties.class, FileInputStream.class, FileUtils.class, ImageIO.class, Context.class})
public class PatientDocumentServiceImplTest {

private PatientDocumentServiceImpl patientDocumentService;
Expand All @@ -54,6 +59,18 @@ public class PatientDocumentServiceImplTest {
@Mock
ThumbnailGenerator thumbnailGenerator;

@Mock
private AdministrationService administrationService;

@Mock
private UserContext userContext;

@Before
public void setUp() {
initMocks(this);
PowerMockito.mockStatic(Context.class);
when(Context.getAdministrationService()).thenReturn(administrationService);
}

@Test
public void shouldCreateRightDirectoryAccordingToPatientId() {
Expand Down Expand Up @@ -176,7 +193,7 @@ public void shouldThrowExceptionWhenImageTypeOtherThanPngJpegGif() throws Except
patientDocumentService = new PatientDocumentServiceImpl();
patientDocumentService.saveDocument(1, "Consultation", "otherfileContent", "bmp", "image", "file-name");
}

@Test
public void shouldCreateThumbnailForVideo() throws Exception {
PowerMockito.mockStatic(BahmniCoreProperties.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public void setUp() throws IOException {
PowerMockito.when(Context.getService(RestService.class)).thenReturn(restService);
PowerMockito.when(Context.getPersonService()).thenReturn(personService);
PowerMockito.when(Context.getMessageSourceService()).thenReturn(messageSourceService);
PowerMockito.when(Context.getAdministrationService()).thenReturn(administrationService);
PowerMockito.when(restService.getResourceBySupportedClass(Patient.class)).thenReturn(patientResource1_8);
PowerMockito.when(patientResource1_8.getPatient(any(SimpleObject.class))).thenReturn(patient);
PowerMockito.when(patientResource1_8.getPatientForUpdate(anyString(), any(SimpleObject.class))).thenReturn(patient);
Expand All @@ -106,7 +107,6 @@ public void createPatient() throws Exception {
when(identifierSourceServiceWrapper.generateIdentifierUsingIdentifierSourceUuid("dead-cafe", "")).thenReturn("BAH300010");
doReturn(delegate).when(bahmniPatientProfileResourceSpy, "mapForCreatePatient", propertiesToCreate);
when(emrPatientProfileService.save(delegate)).thenReturn(delegate);
when(Context.getAdministrationService()).thenReturn(administrationService);
when(Context.getPatientService()).thenReturn(patientService);
Patient patient = mock(Patient.class);
when(patient.getUuid()).thenReturn("patientUuid");
Expand Down
23 changes: 12 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,30 +46,31 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<openMRSVersion>2.5.12</openMRSVersion>
<openMRSWebServicesVersion>2.39.0</openMRSWebServicesVersion>
<openMRSWebServicesVersion>2.44.0</openMRSWebServicesVersion>
<springVersion>5.2.14.RELEASE</springVersion>
<atomfeed.version>1.10.1</atomfeed.version>
<addressHierarchyVersion>2.14.2</addressHierarchyVersion>
<reportingModuleVersion>1.23.0</reportingModuleVersion>
<addressHierarchyVersion>2.17.0</addressHierarchyVersion>
<reportingModuleVersion>1.26.0</reportingModuleVersion>
<calculationModuleVersion>1.3.0</calculationModuleVersion>
<serializationXstreamModuleVersion>0.2.15</serializationXstreamModuleVersion>
<emrapi-omod.version>1.35.0-SNAPSHOT</emrapi-omod.version>
<metadatamapping.version>1.5.0</metadatamapping.version>
<emrapi-omod.version>1.36.0</emrapi-omod.version>
<metadatamapping.version>1.6.0</metadatamapping.version>
<openmrsAtomfeedVersion>2.6.3</openmrsAtomfeedVersion>
<lombokVersion>1.18.20</lombokVersion>
<idgenVersion>4.7.0</idgenVersion>
<legacyuiVersion>1.13.0</legacyuiVersion>
<idgenVersion>4.10.0</idgenVersion>
<legacyuiVersion>1.16.0</legacyuiVersion>
<episodes.version>1.1.0</episodes.version>
<auditLogVersion>1.3.0</auditLogVersion>
<bacteriology.version>1.3.0</bacteriology.version>
<rulesEngineVersion>1.0.0</rulesEngineVersion>
<bahmniJavaUtilsVersion>0.94.4-SNAPSHOT</bahmniJavaUtilsVersion>
<bahmniJavaUtilsVersion>1.0.0</bahmniJavaUtilsVersion>
<javaxServletVersion>4.0.1</javaxServletVersion>
<log4jVersion>2.17.1</log4jVersion>
<idgenWebServicesVersion>1.4.0</idgenWebServicesVersion>
<providermanagementVersion>2.13.0</providermanagementVersion>
<providermanagementVersion>2.14.0</providermanagementVersion>
<velocityVersion>1.6.2</velocityVersion>
<bahmniCommons.version>1.1.0-SNAPSHOT</bahmniCommons.version>
<bahmniCommons.version>1.1.0</bahmniCommons.version>
<communicationVersion>1.2.0</communicationVersion>

<!--test dependencies-->
<junitVersion>4.13</junitVersion>
Expand Down Expand Up @@ -579,7 +580,7 @@
<dependency>
<groupId>org.bahmni.module</groupId>
<artifactId>communication-api</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>${communicationVersion}</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
Expand Down
Loading