Skip to content

Commit

Permalink
Stash
Browse files Browse the repository at this point in the history
Signed-off-by: Finn Carroll <[email protected]>
  • Loading branch information
finnegancarroll committed Sep 12, 2024
1 parent 30a7516 commit 1dc0ad7
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,27 +50,35 @@ public void testProtoExplanationSerDe() {
ExplanationProto proto = explanationToProto(orig);
Explanation cpy = explanationFromProto(proto);
assertEquals(orig, cpy);
assertEquals(orig.hashCode(), cpy.hashCode());
assertNotSame(orig, cpy);
}

public void testProtoDocumentFieldSerDe() {
DocumentField orig = randomDocumentField(randomFrom(XContentType.values()), randomBoolean(), fieldName -> false).v1();
DocumentFieldProto proto = documentFieldToProto(orig);
DocumentField cpy = documentFieldFromProto(proto);
assertEquals(orig, cpy);
assertEquals(orig.hashCode(), cpy.hashCode());
assertNotSame(orig, cpy);
}

public void testProtoHighlightFieldSerDe() {
HighlightField orig = HighlightFieldTests.createTestItem();
HighlightFieldProto proto = highlightFieldToProto(orig);
HighlightField cpy = highlightFieldFromProto(proto);
assertEquals(orig, cpy);
assertEquals(orig.hashCode(), cpy.hashCode());
assertNotSame(orig, cpy);
}

public void testProtoSearchSortValuesSerDe() {
SearchSortValues orig = SearchSortValuesTests.createTestItem(randomFrom(XContentType.values()), true);
SearchSortValuesProto proto = searchSortValuesToProto(orig);
SearchSortValues cpy = searchSortValuesFromProto(proto);
assertEquals(orig, cpy);
assertEquals(orig.hashCode(), cpy.hashCode());
assertNotSame(orig, cpy);
}

public void testProtoSearchShardTargetSerDe() {
Expand All @@ -86,19 +94,25 @@ public void testProtoSearchShardTargetSerDe() {
SearchShardTargetProto proto = searchShardTargetToProto(orig);
SearchShardTarget cpy = searchShardTargetFromProto(proto);
assertEquals(orig, cpy);
assertEquals(orig.hashCode(), cpy.hashCode());
assertNotSame(orig, cpy);
}

public void testProtoShardIdSerDe() {
ShardId orig = new ShardId(new Index(randomAlphaOfLengthBetween(5, 10), randomAlphaOfLengthBetween(5, 10)), randomInt());
ShardIdProto proto = shardIdToProto(orig);
ShardId cpy = shardIdFromProto(proto);
assertEquals(orig, cpy);
assertEquals(orig.hashCode(), cpy.hashCode());
assertNotSame(orig, cpy);
}

public void testProtoIndexSerDe() {
Index orig = new Index(randomAlphaOfLengthBetween(5, 10), randomAlphaOfLengthBetween(5, 10));
IndexProto proto = indexToProto(orig);
Index cpy = indexFromProto(proto);
assertEquals(orig, cpy);
assertEquals(orig.hashCode(), cpy.hashCode());
assertNotSame(orig, cpy);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,27 @@

public class SearchHitsProtobufTests extends AbstractWireSerializingTestCase<SearchHitsProtobuf> {

public void testTotalHitsProtoSerialization () {

}

public void testSortValueProtoSerialization () {

}

public void testSortFieldProtoSerialization () {

}

public void testTotalHitsProtoSerialization () {

}

optional TotalHitsProto total_hits = 5;
repeated SortValueProto collapse_values = 4;
repeated SortFieldProto sort_fields = 3;
repeated SearchHitProto hits = 6;

@Override
protected Writeable.Reader<SearchHitsProtobuf> instanceReader() {
return SearchHitsProtobuf::new;
Expand Down

0 comments on commit 1dc0ad7

Please sign in to comment.