Skip to content

Commit

Permalink
update dependencies (#71)
Browse files Browse the repository at this point in the history
* fix conflicts

* update spring version

* update atomfeed dependency
update server core dependency
  • Loading branch information
bennsimon authored Feb 9, 2022
1 parent fd453fe commit aeeb896
Show file tree
Hide file tree
Showing 17 changed files with 177 additions and 96 deletions.
23 changes: 8 additions & 15 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<artifactId>opensrp-server-connector</artifactId>
<packaging>jar</packaging>
<version>2.3.6-SNAPSHOT</version>
<version>2.4.0-SNAPSHOT</version>
<name>opensrp-server-connector</name>
<description>OpenSRP Server Connector module</description>
<url>http://github.com/OpenSRP/opensrp-server-connector</url>
Expand All @@ -15,12 +15,10 @@
<main.basedir>${project.basedir}</main.basedir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<nexus-staging-maven-plugin.version>1.5.1</nexus-staging-maven-plugin.version>
<spring.version>5.2.3.RELEASE</spring.version>
<opensrp.api.version>1.0.6-SNAPSHOT</opensrp.api.version>
<opensrp.core.version>2.12.23-SNAPSHOT</opensrp.core.version>
<spring.version>5.2.19.RELEASE</spring.version>
<opensrp.core.version>2.13.0-SNAPSHOT</opensrp.core.version>
<powermock.version>2.0.5</powermock.version>
<lombok.version>1.18.12</lombok.version>

</properties>

<distributionManagement>
Expand Down Expand Up @@ -83,11 +81,6 @@
</repositories>

<dependencies>
<dependency>
<groupId>org.smartregister</groupId>
<artifactId>opensrp-server-api</artifactId>
<version>${opensrp.api.version}</version>
</dependency>
<dependency>
<groupId>org.smartregister</groupId>
<artifactId>opensrp-server-core</artifactId>
Expand All @@ -101,7 +94,7 @@
<dependency>
<groupId>org.ict4h</groupId>
<artifactId>atomfeed-client</artifactId>
<version>1.9.1</version>
<version>1.9.5</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
Expand All @@ -114,9 +107,9 @@
<version>1.70</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp</groupId>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>2.7.5</version>
<version>4.9.3</version>
</dependency>
<dependency>
<groupId>org.ektorp</groupId>
Expand All @@ -129,11 +122,11 @@
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
<!-- Test dependencies -->
<!-- Test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/org/opensrp/connector/HttpUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@

import java.io.IOException;

import okhttp3.Call;
import okhttp3.Credentials;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.squareup.okhttp.Call;
import com.squareup.okhttp.Credentials;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;

/**
* @author Samuel Githengi created on 09/10/20
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang3.NotImplementedException;
import org.ektorp.ComplexKey;
import org.ektorp.CouchDbConnector;
import org.ektorp.support.View;
Expand Down Expand Up @@ -92,7 +93,22 @@ public void remove(FailedEvent failedEvent) {
public void insert(FailedEventRetryLog failedEventRetryLog) {

}


@Override
public List<FailedEvent> getFailedEvents(String s) {
throw new NotImplementedException();
}

@Override
public FailedEvent getByEventId(String s) {
throw new NotImplementedException();
}

@Override
public List<FailedEventRetryLog> getFailedEventRetryLogs(String s) {
throw new NotImplementedException();
}

public class AllFailedEventInnerRepository extends BaseRepository<org.opensrp.connector.atomfeed.domain.FailedEvent> {

AllFailedEventInnerRepository(CouchDbConnector db) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.Collections;
import java.util.List;

import org.apache.commons.lang3.NotImplementedException;
import org.ict4h.atomfeed.client.domain.FailedEvent;
import org.ict4h.atomfeed.client.domain.FailedEventRetryLog;
import org.ict4h.atomfeed.client.repository.AllFailedEvents;
Expand Down Expand Up @@ -97,5 +98,20 @@ public void remove(FailedEvent failedEvent) {
public void insert(FailedEventRetryLog failedEventRetryLog) {

}


@Override
public List<FailedEvent> getFailedEvents(String s) {
throw new NotImplementedException();
}

@Override
public FailedEvent getByEventId(String s) {
throw new NotImplementedException();
}

@Override
public List<FailedEventRetryLog> getFailedEventRetryLogs(String s) {
throw new NotImplementedException();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.net.URISyntaxException;
import java.util.List;

import org.apache.commons.lang3.NotImplementedException;
import org.apache.commons.lang3.StringUtils;
import org.ektorp.CouchDbConnector;
import org.ektorp.support.GenerateView;
Expand Down Expand Up @@ -72,5 +73,10 @@ public void put(URI feedUri, String entryId, URI entryFeedUri) {
add(doc);
}
}


@Override
public List<org.ict4h.atomfeed.client.domain.Marker> getMarkerList() {
throw new NotImplementedException();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import java.net.URI;
import java.util.HashMap;
import java.util.List;

import org.apache.commons.lang3.NotImplementedException;
import org.ict4h.atomfeed.client.domain.Marker;
import org.ict4h.atomfeed.client.repository.AllMarkers;
import org.springframework.context.annotation.Profile;
Expand All @@ -26,5 +28,10 @@ public Marker get(URI feedUri) {
public void put(URI feedUri, String entryId, URI entryFeedUri) {
map.put(feedUri, new Marker(feedUri, entryId, entryFeedUri));
}


@Override
public List<Marker> getMarkerList() {
throw new NotImplementedException();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.smartregister.domain.Obs;
import org.opensrp.service.ClientService;
import org.opensrp.service.EventService;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
import org.ict4h.atomfeed.client.repository.AllFailedEvents;
import org.ict4h.atomfeed.client.repository.AllFeeds;
import org.ict4h.atomfeed.client.repository.AllMarkers;
import org.ict4h.atomfeed.client.repository.datasource.WebClient;
import org.ict4h.atomfeed.client.repository.datasource.DefaultHttpClient;
import org.ict4h.atomfeed.client.repository.datasource.HttpClient;
import org.ict4h.atomfeed.client.service.AtomFeedClient;
import org.ict4h.atomfeed.client.service.EventWorker;
import org.ict4h.atomfeed.transaction.AFTransactionManager;
Expand Down Expand Up @@ -37,9 +38,7 @@ public class EncounterAtomfeed extends OpenmrsService implements EventWorker, At
private AtomFeedProperties atomFeedProperties;

private AFTransactionManager transactionManager;

private WebClient webClient;


private AtomFeedClient client;

private EncounterService encounterService;
Expand All @@ -62,7 +61,7 @@ public <T> T executeWithTransaction(AFTransactionWork<T> action) throws RuntimeE
return action.execute();
}
};
this.webClient = new WebClient();
HttpClient webClient = new DefaultHttpClient();

URI uri = new URI(OPENMRS_BASE_URL + OpenmrsConstants.ATOMFEED_URL + CATEGORY_URL);
this.client = new AtomFeedClient(new AllFeeds(webClient), allMarkers, allFailedEvents, atomFeedProperties,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
import org.ict4h.atomfeed.client.repository.AllFailedEvents;
import org.ict4h.atomfeed.client.repository.AllFeeds;
import org.ict4h.atomfeed.client.repository.AllMarkers;
import org.ict4h.atomfeed.client.repository.datasource.WebClient;
import org.ict4h.atomfeed.client.repository.datasource.DefaultHttpClient;
import org.ict4h.atomfeed.client.repository.datasource.HttpClient;
import org.ict4h.atomfeed.client.service.AtomFeedClient;
import org.ict4h.atomfeed.client.service.EventWorker;
import org.ict4h.atomfeed.transaction.AFTransactionManager;
Expand Down Expand Up @@ -74,7 +75,7 @@ public <T> T executeWithTransaction(AFTransactionWork<T> action) throws RuntimeE
return action.execute();
}
};
WebClient webClient = new WebClient();
HttpClient webClient = new DefaultHttpClient();

URI uri = new URI(OPENMRS_BASE_URL + OpenmrsConstants.ATOMFEED_URL + CATEGORY_URL);
this.client = new AtomFeedClient(new AllFeeds(webClient), allMarkers, allFailedEvents, atomFeedProperties,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package org.opensrp.connector.atomfeed;

import org.apache.commons.lang3.NotImplementedException;
import org.junit.Before;
import org.junit.Test;

public class AllFailedEventsInMemoryImplTest {

private AllFailedEventsInMemoryImpl allFailedEventsInMemory;

@Before
public void setUp() {
allFailedEventsInMemory = new AllFailedEventsInMemoryImpl();
}

@Test(expected = NotImplementedException.class)
public void testGetFailedEventRetryLogsShouldReturnNotImplementedException() {
allFailedEventsInMemory.getFailedEventRetryLogs("id");
}

@Test(expected = NotImplementedException.class)
public void testGetFailedEventsShouldReturnNotImplementedException() {
allFailedEventsInMemory.getFailedEvents("id");
}

@Test(expected = NotImplementedException.class)
public void testGetByEventIdShouldReturnNotImplementedException() {
allFailedEventsInMemory.getByEventId("id");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package org.opensrp.connector.atomfeed;

import org.apache.commons.lang3.NotImplementedException;
import org.junit.Before;
import org.junit.Test;

public class AllMarkersInMemoryImplTest {

private AllMarkersInMemoryImpl allMarkersInMemory;

@Before
public void setup(){
allMarkersInMemory = new AllMarkersInMemoryImpl();
}

@Test(expected = NotImplementedException.class)
public void testGetMarkerListShouldReturnNotImplementedException() {
allMarkersInMemory.getMarkerList();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang3.NotImplementedException;
import org.ektorp.CouchDbInstance;
import org.ektorp.http.HttpClient;
import org.ektorp.http.StdHttpClient;
Expand Down Expand Up @@ -125,4 +126,20 @@ public void testGetNumberOfFailedEvents() {
assertEquals(expectedCount, actualCount);
allFailedEventsCouchImpl.remove(failedEvent);
}

@Test(expected = NotImplementedException.class)
public void testGetFailedEventsShouldReturnNotImplementedException() {
allFailedEventsCouchImpl.getFailedEvents("id");
}

@Test
public void testGetByEventIdShouldReturnNotImplementedException() {
allFailedEventsCouchImpl.getByEventId("id");
}

@Test
public void testGetFailedEventRetryLogsShouldReturnNotImplementedException() {
allFailedEventsCouchImpl.getFailedEventRetryLogs("id");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.net.URISyntaxException;
import java.util.List;

import org.apache.commons.lang3.NotImplementedException;
import org.ektorp.CouchDbInstance;
import org.ektorp.http.HttpClient;
import org.ektorp.http.StdHttpClient;
Expand Down Expand Up @@ -99,4 +100,9 @@ public void testFindAllMarkers() throws URISyntaxException {
assertNotSame(expectedSize, marker.size());
allMarkersCouchImpl.removeAll();
}

@Test(expected = NotImplementedException.class)
public void testGetMarkerListShouldReturnNotImplementedException() {
allMarkersCouchImpl.getMarkerList();
}
}
4 changes: 2 additions & 2 deletions src/test/java/org/opensrp/connector/openmrs/AtomFeedTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import java.util.Map;

import org.ict4h.atomfeed.client.AtomFeedProperties;
import org.ict4h.atomfeed.client.repository.datasource.WebClient;
import org.ict4h.atomfeed.client.repository.datasource.HttpClient;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
Expand Down Expand Up @@ -40,7 +40,7 @@ public void setup() {

@Test
public void shouldReadEventsCreatedEvents() throws URISyntaxException {
WebClient wc = Mockito.mock(WebClient.class);
HttpClient wc = Mockito.mock(HttpClient.class);
Map<String, String> m = any();
when(wc.fetch(any(URI.class), any(AtomFeedProperties.class), m)).thenReturn(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?> <feed xmlns=\"http://www.w3.org/2005/Atom\"> <title>Patient AOP</title> <link rel=\"self\" type=\"application/atom+xml\" href=\"http://localhost:8181/openmrs/atomfeed/patient/recent.form\" /> <link rel=\"via\" type=\"application/atom+xml\" href=\"http://localhost:8181/openmrs/atomfeed/patient/1\" /> <author> <name>OpenMRS</name> </author> <id>bec795b1-3d17-451d-b43e-a094019f6984+1</id> <generator uri=\"https://github.com/ICT4H/atomfeed\">OpenMRS Feed Publisher</generator> <updated>2016-03-09T14:47:58Z</updated> <entry> <title>Patient</title> <category term=\"patient\" /> <id>tag:atomfeed.ict4h.org:f376d71e-6ddd-465e-b224-bbe624cbf97f</id> <updated>2016-03-09T14:47:58Z</updated> <published>2016-03-09T14:47:58Z</published> <content type=\"application/vnd.atomfeed+xml\"><![CDATA[/openmrs/ws/rest/v1/patient/42034a79-48bc-47d0-a255-139031665581?v=full]]></content> </entry> </feed> ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class TestResourceLoader {
protected String couchDBPassword;

public TestResourceLoader() throws IOException {
Resource resource = new ClassPathResource("/opensrp.properties");
Resource resource = new ClassPathResource("opensrp.properties");
Properties props = PropertiesLoaderUtils.loadProperties(resource);
openmrsOpenmrsUrl = props.getProperty("openmrs.url");
openmrsUsername = props.getProperty("openmrs.username");
Expand Down
Loading

0 comments on commit aeeb896

Please sign in to comment.