Skip to content

Commit

Permalink
t
Browse files Browse the repository at this point in the history
  • Loading branch information
RuslanLavrov committed Feb 7, 2024
1 parent 4350fdb commit 2b87e96
Show file tree
Hide file tree
Showing 16 changed files with 460 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,7 @@ public static void setUpClass() throws IOException {
.withContent(
new ObjectMapper().readValue(TestUtil.readFileFromPath(RAW_MARC_RECORD_CONTENT_SAMPLE_PATH), String.class));
parsedRecord = new ParsedRecord().withId(recordId)
.withContent(
new ObjectMapper().readValue(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH),
JsonObject.class)
.encode());
.withContent(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH));
}

@Before
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void setUp(TestContext context) throws IOException {
RawRecord rawRecord = new RawRecord()
.withContent(new ObjectMapper().readValue(TestUtil.readFileFromPath(RAW_MARC_RECORD_CONTENT_SAMPLE_PATH), String.class));
ParsedRecord marcRecord = new ParsedRecord()
.withContent(new ObjectMapper().readValue(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH), JsonObject.class).encode());
.withContent(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH));

Snapshot snapshot = TestMocks.getSnapshot(0);
String recordId = UUID.randomUUID().toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public class RecordApiTest extends AbstractRestVerticleTest {
rawMarcRecord = new RawRecord()
.withContent(new ObjectMapper().readValue(TestUtil.readFileFromPath(RAW_MARC_RECORD_CONTENT_SAMPLE_PATH), String.class));
parsedMarcRecord = new ParsedRecord()
.withContent(new ObjectMapper().readValue(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH), JsonObject.class).encode());
.withContent(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH));
rawEdifactRecord = new RawRecord()
.withContent(new ObjectMapper().readValue(TestUtil.readFileFromPath(RAW_EDIFACT_RECORD_CONTENT_SAMPLE_PATH), String.class));
parsedEdifactRecord = new ParsedRecord()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class RecordsGenerationTest extends AbstractRestVerticleTest {
rawRecord = new RawRecord()
.withContent(new ObjectMapper().readValue(TestUtil.readFileFromPath(RAW_MARC_RECORD_CONTENT_SAMPLE_PATH), String.class));
marcRecord = new ParsedRecord()
.withContent(new ObjectMapper().readValue(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH), JsonObject.class).encode());
.withContent(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH));
} catch (IOException e) {
e.printStackTrace();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,8 @@ public void shouldMatchRecordByMultiple024FieldsWithWildcardsInd() {

@Test
public void shouldNotMatchRecordBy035FieldIfRecordExternalIdIsNull(TestContext context) throws IOException {
String parsedRecordContent = new ObjectMapper().readValue(TestUtil.readFileFromPath(PARSED_MARC_WITH_035_FIELD_SAMPLE_PATH), JsonObject.class).encode();
// String parsedRecordContent = new ObjectMapper().readValue(TestUtil.readFileFromPath(PARSED_MARC_WITH_035_FIELD_SAMPLE_PATH), JsonObject.class).encode();
String parsedRecordContent = TestUtil.readFileFromPath(PARSED_MARC_WITH_035_FIELD_SAMPLE_PATH);
String recordId = UUID.randomUUID().toString();
Record record = new Record()
.withId(recordId)
Expand Down Expand Up @@ -312,7 +313,7 @@ public void shouldNotMatchRecordBy035FieldIfRecordExternalIdIsNull(TestContext c

@Test
public void shouldReturnLimitedRecordsIdentifiersCollectionWithLimitAndOffset(TestContext context) throws IOException {
String parsedRecordContent = new ObjectMapper().readValue(TestUtil.readFileFromPath(PARSED_MARC_WITH_035_FIELD_SAMPLE_PATH), JsonObject.class).encode();
String parsedRecordContent = TestUtil.readFileFromPath(PARSED_MARC_WITH_035_FIELD_SAMPLE_PATH);
List<String> recordsIds = List.of("00000000-0000-1000-8000-000000000004", "00000000-0000-1000-8000-000000000002",
"00000000-0000-1000-8000-000000000003", "00000000-0000-1000-8000-000000000001");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,7 @@ public class SourceRecordApiTest extends AbstractRestVerticleTest {
.withContent(
new ObjectMapper().readValue(TestUtil.readFileFromPath(RAW_MARC_RECORD_CONTENT_SAMPLE_PATH), String.class));
marcRecord = new ParsedRecord()
.withContent(
new ObjectMapper().readValue(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH), JsonObject.class)
.encode());
.withContent(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH));
rawEdifactRecord = new RawRecord()
.withContent(
new ObjectMapper().readValue(TestUtil.readFileFromPath(RAW_EDIFACT_RECORD_CONTENT_SAMPLE_PATH), String.class));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public class SourceStorageBatchApiTest extends AbstractRestVerticleTest {
rawRecord = new RawRecord()
.withContent(new ObjectMapper().readValue(TestUtil.readFileFromPath(RAW_MARC_RECORD_CONTENT_SAMPLE_PATH), String.class));
marcRecord = new ParsedRecord()
.withContent(new ObjectMapper().readValue(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH), JsonObject.class).encode());
.withContent(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH));
} catch (IOException e) {
e.printStackTrace();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public class SourceStorageStreamApiTest extends AbstractRestVerticleTest {
rawRecord = new RawRecord()
.withContent(new ObjectMapper().readValue(TestUtil.readFileFromPath(RAW_MARC_RECORD_CONTENT_SAMPLE_PATH), String.class));
marcRecord = new ParsedRecord()
.withContent(new ObjectMapper().readValue(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH), JsonObject.class).encode());
.withContent(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH));
} catch (IOException e) {
e.printStackTrace();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ public static void setUpClass() throws IOException {
.withContent(
new ObjectMapper().readValue(TestUtil.readFileFromPath(RAW_MARC_RECORD_CONTENT_SAMPLE_PATH), String.class));
parsedRecord = new ParsedRecord().withId(recordId)
.withContent(
new ObjectMapper().readValue(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH), JsonObject.class)
.encode());
.withContent(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH));
}

@Before
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public void setUp(TestContext context) throws IOException {
rawRecord = new RawRecord()
.withContent(new ObjectMapper().readValue(TestUtil.readFileFromPath(RAW_MARC_RECORD_CONTENT_SAMPLE_PATH), String.class));
marcRecord = new ParsedRecord()
.withContent(new ObjectMapper().readValue(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH), JsonObject.class).encode());
.withContent(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH));

recordDao = new RecordDaoImpl(postgresClientFactory);
recordService = new RecordServiceImpl(recordDao);
Expand Down Expand Up @@ -686,7 +686,7 @@ public void shouldSaveMarcBibRecordWithMatchedIdFromExistingSourceRecord(TestCon
.withMetadata(original.getMetadata());

ParsedRecord parsedRecord2 = new ParsedRecord()
.withContent(new ObjectMapper().readValue(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH), JsonObject.class).encode());
.withContent(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH));
String recordId2 = UUID.randomUUID().toString();
Record record2 = new Record()
.withId(recordId2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@ public static void setUpClass() throws IOException {
.withContent(
new ObjectMapper().readValue(TestUtil.readFileFromPath(RAW_MARC_RECORD_CONTENT_SAMPLE_PATH), String.class));
parsedRecord = new ParsedRecord().withId(recordId)
.withContent(
new ObjectMapper().readValue(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH), JsonObject.class)
.encode());
.withContent(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH));
}

@Before
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,7 @@ public void shouldSaveRecordWhenRecordDoesntExist(TestContext context) throws IO
.withContent(
new ObjectMapper().readValue(TestUtil.readFileFromPath(RAW_MARC_RECORD_CONTENT_SAMPLE_PATH), String.class));
ParsedRecord parsedRecord = new ParsedRecord().withId(recordId)
.withContent(
new ObjectMapper().readValue(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH), JsonObject.class)
.encode());
.withContent(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH));

Record defaultRecord = new Record()
.withId(recordId)
Expand Down Expand Up @@ -285,9 +283,7 @@ public void shouldUpdateField005WhenThisFiledIsNotProtected(TestContext context)
.withContent(
new ObjectMapper().readValue(TestUtil.readFileFromPath(RAW_MARC_RECORD_CONTENT_SAMPLE_PATH), String.class));
ParsedRecord parsedRecord = new ParsedRecord().withId(recordId)
.withContent(
new ObjectMapper().readValue(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH), JsonObject.class)
.encode());
.withContent(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH));

Record defaultRecord = new Record()
.withId(recordId)
Expand Down Expand Up @@ -346,9 +342,7 @@ public void shouldUpdateField005WhenThisFiledIsProtected(TestContext context) th
.withContent(
new ObjectMapper().readValue(TestUtil.readFileFromPath(RAW_MARC_RECORD_CONTENT_SAMPLE_PATH), String.class));
ParsedRecord parsedRecord = new ParsedRecord().withId(recordId)
.withContent(
new ObjectMapper().readValue(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH), JsonObject.class)
.encode());
.withContent(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH));

Record defaultRecord = new Record()
.withId(recordId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,7 @@ public void shouldSaveRecordWhenRecordDoesntExist(TestContext context) throws IO
.withContent(
new ObjectMapper().readValue(TestUtil.readFileFromPath(RAW_MARC_RECORD_CONTENT_SAMPLE_PATH), String.class));
ParsedRecord parsedRecord = new ParsedRecord().withId(recordId)
.withContent(
new ObjectMapper().readValue(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH), JsonObject.class)
.encode());
.withContent(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH));

Record defaultRecord = new Record()
.withId(recordId)
Expand Down Expand Up @@ -243,9 +241,7 @@ public void shouldUpdateField005WhenThisFiledIsNotProtected(TestContext context)
.withContent(
new ObjectMapper().readValue(TestUtil.readFileFromPath(RAW_MARC_RECORD_CONTENT_SAMPLE_PATH), String.class));
ParsedRecord parsedRecord = new ParsedRecord().withId(recordId)
.withContent(
new ObjectMapper().readValue(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH), JsonObject.class)
.encode());
.withContent(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH));

Record defaultRecord = new Record()
.withId(recordId)
Expand Down Expand Up @@ -305,9 +301,7 @@ public void shouldUpdateField005WhenThisFiledIsProtected(TestContext context) th
.withContent(
new ObjectMapper().readValue(TestUtil.readFileFromPath(RAW_MARC_RECORD_CONTENT_SAMPLE_PATH), String.class));
ParsedRecord parsedRecord = new ParsedRecord().withId(recordId)
.withContent(
new ObjectMapper().readValue(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH), JsonObject.class)
.encode());
.withContent(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH));

Record defaultRecord = new Record()
.withId(recordId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,7 @@ public void shouldSaveRecordWhenRecordDoesntExist(TestContext context) throws IO
RawRecord rawRecord = new RawRecord().withId(recordId)
.withContent(TestUtil.readFileFromPath(RAW_MARC_RECORD_CONTENT_SAMPLE_PATH));
ParsedRecord parsedRecord = new ParsedRecord().withId(recordId)
.withContent(
new ObjectMapper().readValue(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH), JsonObject.class)
.encode());
.withContent(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH));

Record defaultRecord = new Record()
.withId(recordId)
Expand Down Expand Up @@ -314,9 +312,7 @@ public void shouldReturnExceptionForDuplicateRecord(TestContext context) throws
RawRecord rawRecord = new RawRecord().withId(recordId)
.withContent(TestUtil.readFileFromPath(RAW_MARC_RECORD_CONTENT_SAMPLE_PATH));
ParsedRecord parsedRecord = new ParsedRecord().withId(recordId)
.withContent(
new ObjectMapper().readValue(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH), JsonObject.class)
.encode());
.withContent(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH));

Record defaultRecord = new Record()
.withId(recordId)
Expand All @@ -329,9 +325,7 @@ public void shouldReturnExceptionForDuplicateRecord(TestContext context) throws
RawRecord rawRecordDuplicate = new RawRecord().withId(recordId)
.withContent(TestUtil.readFileFromPath(RAW_MARC_RECORD_CONTENT_SAMPLE_PATH));
ParsedRecord parsedRecordDuplicate = new ParsedRecord().withId(recordId)
.withContent(
new ObjectMapper().readValue(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH), JsonObject.class)
.encode());
.withContent(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH));

Record duplicateRecord = new Record()
.withId(duplicateRecordId)
Expand Down Expand Up @@ -405,9 +399,7 @@ public void shouldSaveIncomingRecordAndMarkExistingAsOldWhenIncomingRecordHasSam
RawRecord rawRecord = new RawRecord().withId(recordId)
.withContent(TestUtil.readFileFromPath(RAW_MARC_RECORD_CONTENT_SAMPLE_PATH));
ParsedRecord parsedRecord = new ParsedRecord().withId(recordId)
.withContent(
new ObjectMapper().readValue(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH), JsonObject.class)
.encode());
.withContent(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH));

Record incomingRecord = new Record()
.withRawRecord(rawRecord)
Expand Down Expand Up @@ -568,9 +560,7 @@ public void shouldUpdateField005WhenThisFiledIsNotProtected(TestContext context)
.withContent(
new ObjectMapper().readValue(TestUtil.readFileFromPath(RAW_MARC_RECORD_CONTENT_SAMPLE_PATH), String.class));
ParsedRecord parsedRecord = new ParsedRecord().withId(recordId)
.withContent(
new ObjectMapper().readValue(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH), JsonObject.class)
.encode());
.withContent(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH));

Record defaultRecord = new Record()
.withId(recordId)
Expand Down Expand Up @@ -630,9 +620,7 @@ public void shouldUpdateField005WhenThisFiledIsProtected(TestContext context) th
.withContent(
new ObjectMapper().readValue(TestUtil.readFileFromPath(RAW_MARC_RECORD_CONTENT_SAMPLE_PATH), String.class));
ParsedRecord parsedRecord = new ParsedRecord().withId(recordId)
.withContent(
new ObjectMapper().readValue(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH), JsonObject.class)
.encode());
.withContent(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH));

Record defaultRecord = new Record()
.withId(recordId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static void loadMockRecords(TestContext context) throws IOException {
rawMarcRecord = new RawRecord()
.withContent(new ObjectMapper().readValue(TestUtil.readFileFromPath(RAW_MARC_RECORD_CONTENT_SAMPLE_PATH), String.class));
parsedMarcRecord = new ParsedRecord()
.withContent(new ObjectMapper().readValue(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH), JsonObject.class).encode());
.withContent(TestUtil.readFileFromPath(PARSED_MARC_RECORD_CONTENT_SAMPLE_PATH));
rawEdifactRecord = new RawRecord()
.withContent(new ObjectMapper().readValue(TestUtil.readFileFromPath(RAW_EDIFACT_RECORD_CONTENT_SAMPLE_PATH), String.class));
parsedEdifactRecord = new ParsedRecord()
Expand Down
Loading

0 comments on commit 2b87e96

Please sign in to comment.