Skip to content

Commit 773d1a0

Browse files
Kiefer Coverkcover
Kiefer Cover
authored andcommitted
REP-264 Add modified time to Ion ingest requests
-Adds the "Last-Modified" header to Ion ingest requests -Updates the readme where needed -Removes docker layer caching from circleCI configs since it's only available on a paid version
1 parent 6140276 commit 773d1a0

File tree

4 files changed

+25
-20
lines changed

4 files changed

+25
-20
lines changed

.circleci/config.yml

+2-4
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ jobs:
2727
- mvn-repo-v1-{{ .Branch }}-sonar
2828
- mvn-repo-v1-{{ .Branch }}-owasp
2929
- mvn-repo-v1-{{ .Branch }}
30-
- setup_remote_docker:
31-
docker_layer_caching: true
30+
- setup_remote_docker
3231
- run:
3332
name: Building
3433
command: |
@@ -66,8 +65,7 @@ jobs:
6665
- run: *env
6766
- checkout
6867
- restore_cache: *restore_cache
69-
- setup_remote_docker:
70-
docker_layer_caching: true
68+
- setup_remote_docker
7169
- run:
7270
name: Building
7371
command: |

README.md

+15-16
Original file line numberDiff line numberDiff line change
@@ -150,26 +150,25 @@ curl -H "Content-Type: application/json" \
150150
-d @sites.json \
151151
http://localhost:8983/solr/replication_site/update?commitWithin=1000
152152
```
153-
###### Adding Replication Jobs Example
154-
Example jobs.json
153+
###### Adding Replication Filters Example
154+
Example filters.json
155155
```json
156-
[
157-
{
158-
"version": 1,
159-
"id": "unique-job-id-98765",
160-
"name": "pdf-harvest",
161-
"bidirectional": false,
162-
"source":" some-unique-id-1234",
163-
"destination": "another-unique-id-5678",
164-
"filter": "\"media.type\" like 'application/pdf'",
165-
"suspended": false
166-
}
167-
]
156+
[
157+
{
158+
"name":"pdf-harvest",
159+
"site_id":"remote-node-id",
160+
"filter":"\"media.type\" like 'application/pdf'",
161+
"suspended":false,
162+
"priority": 0,
163+
"id":"unique-filter-id-98765",
164+
"version":1
165+
}
166+
]
168167
```
169168
```
170169
curl -H "Content-Type: application/json" \
171-
-d @jobs.json \
172-
http://localhost:8983/solr/replication_config/update?commitWithin=1000
170+
-d @filters.json \
171+
http://localhost:8983/solr/replication_filter/update?commitWithin=1000
173172
```
174173

175174
#### Removing Replication Configuration

adapters/ion-adapter/src/main/java/com/connexta/replication/adapters/ion/IonNodeAdapter.java

+2
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ public boolean createResource(CreateStorageRequest createStorageRequest) {
124124
HttpHeaders headers = new HttpHeaders();
125125
headers.set("Accept-Version", "0.1.0");
126126
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
127+
headers.set(
128+
"Last-Modified", resource.getMetadata().getMetadataModified().toInstant().toString());
127129

128130
HttpEntity<MultiValueMap<String, Object>> requestEntity =
129131
new HttpEntity(multipartBody, headers);

adapters/ion-adapter/src/test/java/com/connexta/replication/adapters/ion/IonNodeAdapterTest.java

+6
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import static org.mockito.Mockito.mock;
2121
import static org.mockito.Mockito.when;
2222
import static org.springframework.test.web.client.match.MockRestRequestMatchers.content;
23+
import static org.springframework.test.web.client.match.MockRestRequestMatchers.header;
2324
import static org.springframework.test.web.client.match.MockRestRequestMatchers.method;
2425
import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
2526
import static org.springframework.test.web.client.response.MockRestResponseCreators.withStatus;
@@ -35,6 +36,7 @@
3536
import java.io.InterruptedIOException;
3637
import java.net.URI;
3738
import java.net.URL;
39+
import java.util.Date;
3840
import org.codice.junit.ClearInterruptions;
3941
import org.codice.junit.rules.MethodRuleAnnotationProcessor;
4042
import org.hamcrest.Matchers;
@@ -57,6 +59,8 @@ public class IonNodeAdapterTest {
5759
@Rule public ExpectedException thrown = ExpectedException.none();
5860
@Rule public final MethodRuleAnnotationProcessor processor = new MethodRuleAnnotationProcessor();
5961

62+
private static final Date EPOCH = new Date(0);
63+
6064
RestTemplate restTemplate;
6165

6266
MockRestServiceServer mockServer;
@@ -104,6 +108,7 @@ public void createResource() {
104108
.andExpect(content().string(containsString(resourceFormData())))
105109
.andExpect(content().string(containsString(correlationIdFormData())))
106110
.andExpect(content().string(containsString(metadataFormData())))
111+
.andExpect(header("Last-Modified", EPOCH.toInstant().toString()))
107112
.andRespond(withStatus(HttpStatus.ACCEPTED));
108113

109114
assertThat(adapter.createResource(getCreateStorageRequest()), is(true));
@@ -228,6 +233,7 @@ public Metadata getMetadata() {
228233
Metadata metadata = mock(Metadata.class);
229234
when(metadata.getMetadataSize()).thenReturn((long) getRawMetadata().length());
230235
when(metadata.getRawMetadata()).thenReturn(getRawMetadata());
236+
when(metadata.getMetadataModified()).thenReturn(EPOCH);
231237
return metadata;
232238
}
233239
};

0 commit comments

Comments
 (0)