From 1d73a340974bbce26e3a0eaf4372f84098208b9e Mon Sep 17 00:00:00 2001 From: Jesse Jia Date: Sun, 29 Oct 2023 11:39:15 -0700 Subject: [PATCH] [Part 1][Persist message id] Adjust interface to persist message id (#308) * Persist message id into entity table * revert * use UUID * fix style * fix style * fix style --------- Co-authored-by: Jesse Jia --- .../metadata/dao/EbeanLocalAccess.java | 6 +- .../linkedin/metadata/dao/EbeanLocalDAO.java | 9 ++- .../metadata/dao/IEbeanLocalAccess.java | 3 +- .../metadata/dao/EbeanLocalAccessTest.java | 35 ++++++----- .../EbeanLocalRelationshipQueryDAOTest.java | 58 +++++++++++-------- .../java/com/linkedin/testing/TestUtils.java | 13 ----- 6 files changed, 63 insertions(+), 61 deletions(-) diff --git a/dao-impl/ebean-dao/src/main/java/com/linkedin/metadata/dao/EbeanLocalAccess.java b/dao-impl/ebean-dao/src/main/java/com/linkedin/metadata/dao/EbeanLocalAccess.java index 817c550c2..7dec87821 100644 --- a/dao-impl/ebean-dao/src/main/java/com/linkedin/metadata/dao/EbeanLocalAccess.java +++ b/dao-impl/ebean-dao/src/main/java/com/linkedin/metadata/dao/EbeanLocalAccess.java @@ -1,5 +1,6 @@ package com.linkedin.metadata.dao; +import com.linkedin.avro2pegasus.events.UUID; import com.linkedin.common.AuditStamp; import com.linkedin.common.urn.Urn; import com.linkedin.data.template.RecordTemplate; @@ -91,7 +92,7 @@ public void ensureSchemaUpToDate() { @Override @Transactional public int add(@Nonnull URN urn, @Nullable ASPECT newValue, @Nonnull Class aspectClass, - @Nonnull AuditStamp auditStamp) { + @Nonnull AuditStamp auditStamp, @Nullable UUID messageId) { final long timestamp = auditStamp.hasTime() ? auditStamp.getTime() : System.currentTimeMillis(); final String actor = auditStamp.hasActor() ? auditStamp.getActor().toString() : DEFAULT_ACTOR; @@ -282,9 +283,6 @@ public ListResult list(@Nonnull Class ListResult list(@Nonnull Class aspectClass, int start, diff --git a/dao-impl/ebean-dao/src/main/java/com/linkedin/metadata/dao/EbeanLocalDAO.java b/dao-impl/ebean-dao/src/main/java/com/linkedin/metadata/dao/EbeanLocalDAO.java index 5bab89e63..60bb34562 100644 --- a/dao-impl/ebean-dao/src/main/java/com/linkedin/metadata/dao/EbeanLocalDAO.java +++ b/dao-impl/ebean-dao/src/main/java/com/linkedin/metadata/dao/EbeanLocalDAO.java @@ -1,6 +1,7 @@ package com.linkedin.metadata.dao; import com.google.common.annotations.VisibleForTesting; +import com.linkedin.avro2pegasus.events.UUID; import com.linkedin.common.AuditStamp; import com.linkedin.common.urn.Urn; import com.linkedin.data.schema.DataSchema; @@ -630,7 +631,7 @@ public void updateEntityTables(@Nonnull URN urn, return null; // unused } AuditStamp auditStamp = makeAuditStamp(result); - _localAccess.add(urn, toRecordTemplate(aspectClass, result).orElse(null), aspectClass, auditStamp); + _localAccess.add(urn, toRecordTemplate(aspectClass, result).orElse(null), aspectClass, auditStamp, null); return null; // unused }, 1); } @@ -760,7 +761,8 @@ protected void updateWithOptimisticLocking(@Nonn if (_schemaConfig == SchemaConfig.NEW_SCHEMA_ONLY || _schemaConfig == SchemaConfig.DUAL_SCHEMA) { // ensure atomicity by running old schema update + new schema update in a transaction numOfUpdatedRows = runInTransactionWithRetry(() -> { - _localAccess.add(urn, (ASPECT) value, aspectClass, newAuditStamp); + UUID messageId = trackingContext != null ? trackingContext.getTrackingId() : null; + _localAccess.add(urn, (ASPECT) value, aspectClass, newAuditStamp, messageId); return _server.execute(update); }, 1); } else { @@ -782,7 +784,8 @@ protected void insert(@Nonnull URN urn, @Nullabl if (_schemaConfig != SchemaConfig.OLD_SCHEMA_ONLY && version == LATEST_VERSION) { // insert() could be called when updating log table (moving current versions into new history version) // the metadata entity tables shouldn't been updated. - _localAccess.add(urn, (ASPECT) value, aspectClass, auditStamp); + UUID messageId = trackingContext != null ? trackingContext.getTrackingId() : null; + _localAccess.add(urn, (ASPECT) value, aspectClass, auditStamp, messageId); } if (_changeLogEnabled) { diff --git a/dao-impl/ebean-dao/src/main/java/com/linkedin/metadata/dao/IEbeanLocalAccess.java b/dao-impl/ebean-dao/src/main/java/com/linkedin/metadata/dao/IEbeanLocalAccess.java index 59e35a259..ff44804ba 100644 --- a/dao-impl/ebean-dao/src/main/java/com/linkedin/metadata/dao/IEbeanLocalAccess.java +++ b/dao-impl/ebean-dao/src/main/java/com/linkedin/metadata/dao/IEbeanLocalAccess.java @@ -1,5 +1,6 @@ package com.linkedin.metadata.dao; +import com.linkedin.avro2pegasus.events.UUID; import com.linkedin.common.AuditStamp; import com.linkedin.common.urn.Urn; import com.linkedin.data.template.RecordTemplate; @@ -31,7 +32,7 @@ public interface IEbeanLocalAccess { * @return number of rows inserted or updated */ int add(@Nonnull URN urn, @Nullable ASPECT newValue, @Nonnull Class aspectClass, - @Nonnull AuditStamp auditStamp); + @Nonnull AuditStamp auditStamp, @Nullable UUID messageId); /** * Upsert relationships to the local relationship table(s). diff --git a/dao-impl/ebean-dao/src/test/java/com/linkedin/metadata/dao/EbeanLocalAccessTest.java b/dao-impl/ebean-dao/src/test/java/com/linkedin/metadata/dao/EbeanLocalAccessTest.java index 850010357..7e597868c 100644 --- a/dao-impl/ebean-dao/src/test/java/com/linkedin/metadata/dao/EbeanLocalAccessTest.java +++ b/dao-impl/ebean-dao/src/test/java/com/linkedin/metadata/dao/EbeanLocalAccessTest.java @@ -1,7 +1,9 @@ package com.linkedin.metadata.dao; import com.google.common.io.Resources; +import com.linkedin.avro2pegasus.events.UUID; import com.linkedin.common.AuditStamp; +import com.linkedin.data.ByteString; import com.linkedin.metadata.dao.localrelationship.SampleLocalRelationshipRegistryImpl; import com.linkedin.metadata.dao.scsi.EmptyPathExtractor; import com.linkedin.metadata.dao.utils.BarUrnPathExtractor; @@ -55,6 +57,7 @@ public class EbeanLocalAccessTest { private static IEbeanLocalAccess _ebeanLocalAccessBurger; private static long _now; private static final LocalRelationshipFilter EMPTY_FILTER = new LocalRelationshipFilter().setCriteria(new LocalRelationshipCriterionArray()); + private static final byte[] UUID = {0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1}; @BeforeClass public void init() { @@ -81,7 +84,7 @@ public void setupTest() throws IOException { AspectFoo aspectFoo = new AspectFoo(); aspectFoo.setValue(String.valueOf(i)); AuditStamp auditStamp = makeAuditStamp("foo", System.currentTimeMillis()); - _ebeanLocalAccessFoo.add(fooUrn, aspectFoo, AspectFoo.class, auditStamp); + _ebeanLocalAccessFoo.add(fooUrn, aspectFoo, AspectFoo.class, auditStamp, new UUID(ByteString.copy(UUID))); } } @@ -266,7 +269,7 @@ public void testCountAggregate() { AspectFoo aspectFoo = new AspectFoo(); aspectFoo.setValue(String.valueOf(25)); AuditStamp auditStamp = makeAuditStamp("foo", System.currentTimeMillis()); - _ebeanLocalAccessFoo.add(fooUrn, aspectFoo, AspectFoo.class, auditStamp); + _ebeanLocalAccessFoo.add(fooUrn, aspectFoo, AspectFoo.class, auditStamp, new UUID(ByteString.copy(UUID))); countMap = _ebeanLocalAccessFoo.countAggregate(indexFilter, indexGroupByCriterion); // Expect: there are 2 counts for value 25 @@ -280,7 +283,7 @@ public void testEscapeSpecialCharInUrn() { // Single quote is a special char in SQL. BurgerUrn johnsBurgerUrn1 = makeBurgerUrn("urn:li:burger:John's burger"); - _ebeanLocalAccessBurger.add(johnsBurgerUrn1, aspectFoo, AspectFoo.class, auditStamp); + _ebeanLocalAccessBurger.add(johnsBurgerUrn1, aspectFoo, AspectFoo.class, auditStamp, new UUID(ByteString.copy(UUID))); AspectKey aspectKey1 = new AspectKey(AspectFoo.class, johnsBurgerUrn1, 0L); List ebeanMetadataAspectList = _ebeanLocalAccessFoo.batchGetUnion(Collections.singletonList(aspectKey1), 1, 0, false); @@ -289,7 +292,7 @@ public void testEscapeSpecialCharInUrn() { // Double quote is a special char in SQL. BurgerUrn johnsBurgerUrn2 = makeBurgerUrn("urn:li:burger:John\"s burger"); - _ebeanLocalAccessBurger.add(johnsBurgerUrn2, aspectFoo, AspectFoo.class, auditStamp); + _ebeanLocalAccessBurger.add(johnsBurgerUrn2, aspectFoo, AspectFoo.class, auditStamp, new UUID(ByteString.copy(UUID))); AspectKey aspectKey2 = new AspectKey(AspectFoo.class, johnsBurgerUrn2, 0L); ebeanMetadataAspectList = _ebeanLocalAccessFoo.batchGetUnion(Collections.singletonList(aspectKey2), 1, 0, false); @@ -298,7 +301,7 @@ public void testEscapeSpecialCharInUrn() { // Backslash is a special char in SQL. BurgerUrn johnsBurgerUrn3 = makeBurgerUrn("urn:li:burger:John\\s burger"); - _ebeanLocalAccessBurger.add(johnsBurgerUrn3, aspectFoo, AspectFoo.class, auditStamp); + _ebeanLocalAccessBurger.add(johnsBurgerUrn3, aspectFoo, AspectFoo.class, auditStamp, new UUID(ByteString.copy(UUID))); AspectKey aspectKey3 = new AspectKey(AspectFoo.class, johnsBurgerUrn3, 0L); ebeanMetadataAspectList = _ebeanLocalAccessFoo.batchGetUnion(Collections.singletonList(aspectKey3), 1, 0, false); @@ -315,10 +318,10 @@ public void testAddWithLocalRelationshipBuilder() throws URISyntaxException { AspectFooBar aspectFooBar = new AspectFooBar().setBars(new BarUrnArray(barUrn1, barUrn2, barUrn3)); AuditStamp auditStamp = makeAuditStamp("foo", System.currentTimeMillis()); - _ebeanLocalAccessFoo.add(fooUrn, aspectFooBar, AspectFooBar.class, auditStamp); - _ebeanLocalAccessBar.add(barUrn1, new AspectFoo().setValue("1"), AspectFoo.class, auditStamp); - _ebeanLocalAccessBar.add(barUrn2, new AspectFoo().setValue("2"), AspectFoo.class, auditStamp); - _ebeanLocalAccessBar.add(barUrn3, new AspectFoo().setValue("3"), AspectFoo.class, auditStamp); + _ebeanLocalAccessFoo.add(fooUrn, aspectFooBar, AspectFooBar.class, auditStamp, new UUID(ByteString.copy(UUID))); + _ebeanLocalAccessBar.add(barUrn1, new AspectFoo().setValue("1"), AspectFoo.class, auditStamp, new UUID(ByteString.copy(UUID))); + _ebeanLocalAccessBar.add(barUrn2, new AspectFoo().setValue("2"), AspectFoo.class, auditStamp, new UUID(ByteString.copy(UUID))); + _ebeanLocalAccessBar.add(barUrn3, new AspectFoo().setValue("3"), AspectFoo.class, auditStamp, new UUID(ByteString.copy(UUID))); // Verify local relationships and entity are added. EbeanLocalRelationshipQueryDAO ebeanLocalRelationshipQueryDAO = new EbeanLocalRelationshipQueryDAO(_server); @@ -345,7 +348,7 @@ public void testAtomicityWithLocalRelationshipBuilder() throws URISyntaxExceptio AuditStamp auditStamp = makeAuditStamp("foo", System.currentTimeMillis()); try { - _ebeanLocalAccessFoo.add(makeFooUrn(1), aspectFooBar, AspectFooBar.class, auditStamp); + _ebeanLocalAccessFoo.add(makeFooUrn(1), aspectFooBar, AspectFooBar.class, auditStamp, new UUID(ByteString.copy(UUID))); } catch (Exception exception) { // Verify no relationship is added. List relationships = _server.createSqlQuery("SELECT * FROM metadata_relationship_belongsto").findList(); @@ -357,7 +360,7 @@ public void testAtomicityWithLocalRelationshipBuilder() throws URISyntaxExceptio public void testUrnExtraction() { FooUrn urn1 = makeFooUrn(1); AspectFoo foo1 = new AspectFoo().setValue("foo"); - _ebeanLocalAccessFoo.add(urn1, foo1, AspectFoo.class, makeAuditStamp("actor", _now)); + _ebeanLocalAccessFoo.add(urn1, foo1, AspectFoo.class, makeAuditStamp("actor", _now), new UUID(ByteString.copy(UUID))); // get content of virtual column List results = _server.createSqlQuery("SELECT i_urn$fooId as id FROM metadata_entity_foo").findList(); @@ -379,10 +382,10 @@ public void testAddRelationships() throws URISyntaxException { // Turn off local relationship ingestion first, to fill only the entity tables. _ebeanLocalAccessFoo.setLocalRelationshipBuilderRegistry(null); - _ebeanLocalAccessFoo.add(fooUrn, aspectFooBar, AspectFooBar.class, auditStamp); - _ebeanLocalAccessBar.add(barUrn1, new AspectFoo().setValue("1"), AspectFoo.class, auditStamp); - _ebeanLocalAccessBar.add(barUrn2, new AspectFoo().setValue("2"), AspectFoo.class, auditStamp); - _ebeanLocalAccessBar.add(barUrn3, new AspectFoo().setValue("3"), AspectFoo.class, auditStamp); + _ebeanLocalAccessFoo.add(fooUrn, aspectFooBar, AspectFooBar.class, auditStamp, new UUID(ByteString.copy(UUID))); + _ebeanLocalAccessBar.add(barUrn1, new AspectFoo().setValue("1"), AspectFoo.class, auditStamp, new UUID(ByteString.copy(UUID))); + _ebeanLocalAccessBar.add(barUrn2, new AspectFoo().setValue("2"), AspectFoo.class, auditStamp, new UUID(ByteString.copy(UUID))); + _ebeanLocalAccessBar.add(barUrn3, new AspectFoo().setValue("3"), AspectFoo.class, auditStamp, new UUID(ByteString.copy(UUID))); // Verify that NO local relationships were added EbeanLocalRelationshipQueryDAO ebeanLocalRelationshipQueryDAO = new EbeanLocalRelationshipQueryDAO(_server); @@ -440,7 +443,7 @@ public void testFindLatestMetadataAspect() throws URISyntaxException { @Test public void testGetAspectNoSoftDeleteCheck() { FooUrn fooUrn = makeFooUrn(0); - _ebeanLocalAccessFoo.add(fooUrn, null, AspectFoo.class, makeAuditStamp("foo", System.currentTimeMillis())); + _ebeanLocalAccessFoo.add(fooUrn, null, AspectFoo.class, makeAuditStamp("foo", System.currentTimeMillis()), new UUID(ByteString.copy(UUID))); AspectKey aspectKey = new AspectKey(AspectFoo.class, fooUrn, 0L); List ebeanMetadataAspectList = _ebeanLocalAccessFoo.batchGetUnion(Collections.singletonList(aspectKey), 1000, 0, false); diff --git a/dao-impl/ebean-dao/src/test/java/com/linkedin/metadata/dao/localrelationship/EbeanLocalRelationshipQueryDAOTest.java b/dao-impl/ebean-dao/src/test/java/com/linkedin/metadata/dao/localrelationship/EbeanLocalRelationshipQueryDAOTest.java index f1b7040a9..b364202e7 100644 --- a/dao-impl/ebean-dao/src/test/java/com/linkedin/metadata/dao/localrelationship/EbeanLocalRelationshipQueryDAOTest.java +++ b/dao-impl/ebean-dao/src/test/java/com/linkedin/metadata/dao/localrelationship/EbeanLocalRelationshipQueryDAOTest.java @@ -2,7 +2,9 @@ import com.google.common.collect.ImmutableSet; import com.google.common.io.Resources; +import com.linkedin.avro2pegasus.events.UUID; import com.linkedin.common.AuditStamp; +import com.linkedin.data.ByteString; import com.linkedin.data.template.RecordTemplate; import com.linkedin.data.template.StringArray; import com.linkedin.metadata.dao.EbeanLocalAccess; @@ -51,6 +53,7 @@ public class EbeanLocalRelationshipQueryDAOTest { private EbeanLocalRelationshipQueryDAO _localRelationshipQueryDAO; private IEbeanLocalAccess _fooUrnEBeanLocalAccess; private IEbeanLocalAccess _barUrnEBeanLocalAccess; + private static final byte[] UUID = {0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1}; @BeforeClass public void init() { @@ -72,7 +75,7 @@ public void recreateTables() throws IOException { @Test public void testFindOneEntity() throws URISyntaxException { // Ingest data - _fooUrnEBeanLocalAccess.add(new FooUrn(1), new AspectFoo().setValue("foo"), AspectFoo.class, new AuditStamp()); + _fooUrnEBeanLocalAccess.add(new FooUrn(1), new AspectFoo().setValue("foo"), AspectFoo.class, new AuditStamp(), new UUID(ByteString.copy(UUID))); // Prepare filter AspectField aspectField = new AspectField().setAspect(AspectFoo.class.getCanonicalName()).setPath("/value"); @@ -95,8 +98,8 @@ public void testFindOneEntity() throws URISyntaxException { @Test public void testFindOneEntityTwoAspects() throws URISyntaxException { // Ingest data - _fooUrnEBeanLocalAccess.add(new FooUrn(1), new AspectFoo().setValue("foo"), AspectFoo.class, new AuditStamp()); - _fooUrnEBeanLocalAccess.add(new FooUrn(1), new AspectBar().setValue("bar"), AspectBar.class, new AuditStamp()); + _fooUrnEBeanLocalAccess.add(new FooUrn(1), new AspectFoo().setValue("foo"), AspectFoo.class, new AuditStamp(), new UUID(ByteString.copy(UUID))); + _fooUrnEBeanLocalAccess.add(new FooUrn(1), new AspectBar().setValue("bar"), AspectBar.class, new AuditStamp(), new UUID(ByteString.copy(UUID))); // Prepare filter AspectField aspectField = new AspectField().setAspect(AspectFoo.class.getCanonicalName()).setPath("/value"); @@ -131,9 +134,9 @@ public void testFindOneRelationship() throws Exception { FooUrn jack = new FooUrn(3); // Add Alice, Bob and Jack into entity tables. - _fooUrnEBeanLocalAccess.add(alice, new AspectFoo().setValue("Alice"), AspectFoo.class, new AuditStamp()); - _fooUrnEBeanLocalAccess.add(bob, new AspectFoo().setValue("Bob"), AspectFoo.class, new AuditStamp()); - _fooUrnEBeanLocalAccess.add(jack, new AspectFoo().setValue("Jack"), AspectFoo.class, new AuditStamp()); + _fooUrnEBeanLocalAccess.add(alice, new AspectFoo().setValue("Alice"), AspectFoo.class, new AuditStamp(), new UUID(ByteString.copy(UUID))); + _fooUrnEBeanLocalAccess.add(bob, new AspectFoo().setValue("Bob"), AspectFoo.class, new AuditStamp(), new UUID(ByteString.copy(UUID))); + _fooUrnEBeanLocalAccess.add(jack, new AspectFoo().setValue("Jack"), AspectFoo.class, new AuditStamp(), new UUID(ByteString.copy(UUID))); // Add Bob reports-to ALice relationship ReportsTo bobReportsToAlice = new ReportsTo().setSource(bob).setDestination(alice); @@ -172,9 +175,9 @@ public void testFindEntitiesOneHopAwayIncomingDirection() throws Exception { FooUrn jack = new FooUrn(3); // Add Alice, Bob and Jack into entity tables. - _fooUrnEBeanLocalAccess.add(alice, new AspectFoo().setValue("Alice"), AspectFoo.class, new AuditStamp()); - _fooUrnEBeanLocalAccess.add(bob, new AspectFoo().setValue("Bob"), AspectFoo.class, new AuditStamp()); - _fooUrnEBeanLocalAccess.add(jack, new AspectFoo().setValue("Jack"), AspectFoo.class, new AuditStamp()); + _fooUrnEBeanLocalAccess.add(alice, new AspectFoo().setValue("Alice"), AspectFoo.class, new AuditStamp(), new UUID(ByteString.copy(UUID))); + _fooUrnEBeanLocalAccess.add(bob, new AspectFoo().setValue("Bob"), AspectFoo.class, new AuditStamp(), new UUID(ByteString.copy(UUID))); + _fooUrnEBeanLocalAccess.add(jack, new AspectFoo().setValue("Jack"), AspectFoo.class, new AuditStamp(), new UUID(ByteString.copy(UUID))); // Add Bob reports-to ALice relationship ReportsTo bobReportsToAlice = new ReportsTo().setSource(bob).setDestination(alice); @@ -225,12 +228,12 @@ public void testFindEntitiesOneHopAwayOutgoingDirection() throws Exception { BarUrn mit = new BarUrn(2); // Add Alice and Bob into entity tables. - _fooUrnEBeanLocalAccess.add(alice, new AspectFoo().setValue("Alice"), AspectFoo.class, new AuditStamp()); - _fooUrnEBeanLocalAccess.add(bob, new AspectFoo().setValue("Bob"), AspectFoo.class, new AuditStamp()); + _fooUrnEBeanLocalAccess.add(alice, new AspectFoo().setValue("Alice"), AspectFoo.class, new AuditStamp(), new UUID(ByteString.copy(UUID))); + _fooUrnEBeanLocalAccess.add(bob, new AspectFoo().setValue("Bob"), AspectFoo.class, new AuditStamp(), new UUID(ByteString.copy(UUID))); // Add Stanford and MIT into entity tables. - _barUrnEBeanLocalAccess.add(stanford, new AspectFoo().setValue("Stanford"), AspectFoo.class, new AuditStamp()); - _barUrnEBeanLocalAccess.add(mit, new AspectFoo().setValue("MIT"), AspectFoo.class, new AuditStamp()); + _barUrnEBeanLocalAccess.add(stanford, new AspectFoo().setValue("Stanford"), AspectFoo.class, new AuditStamp(), new UUID(ByteString.copy(UUID))); + _barUrnEBeanLocalAccess.add(mit, new AspectFoo().setValue("MIT"), AspectFoo.class, new AuditStamp(), new UUID(ByteString.copy(UUID))); // Add Alice belongs to MIT and Stanford. BelongsTo aliceBelongsToMit = new BelongsTo().setSource(alice).setDestination(mit); @@ -285,15 +288,22 @@ public void testFindEntitiesOneHopAwayUndirected() throws Exception { FooUrn john = new FooUrn(4); // Add Alice, Bob, Jack and John into entity tables. - _fooUrnEBeanLocalAccess.add(alice, new AspectFoo().setValue("Alice"), AspectFoo.class, new AuditStamp()); - _fooUrnEBeanLocalAccess.add(bob, new AspectFoo().setValue("Bob"), AspectFoo.class, new AuditStamp()); - _fooUrnEBeanLocalAccess.add(jack, new AspectFoo().setValue("Jack"), AspectFoo.class, new AuditStamp()); - _fooUrnEBeanLocalAccess.add(john, new AspectFoo().setValue("John"), AspectFoo.class, new AuditStamp()); + _fooUrnEBeanLocalAccess.add(alice, new AspectFoo().setValue("Alice"), AspectFoo.class, new AuditStamp(), new UUID(ByteString.copy(UUID))); + _fooUrnEBeanLocalAccess.add(bob, new AspectFoo().setValue("Bob"), AspectFoo.class, new AuditStamp(), new UUID(ByteString.copy(UUID))); + _fooUrnEBeanLocalAccess.add(jack, new AspectFoo().setValue("Jack"), AspectFoo.class, new AuditStamp(), new UUID(ByteString.copy(UUID))); + _fooUrnEBeanLocalAccess.add(john, new AspectFoo().setValue("John"), AspectFoo.class, new AuditStamp(), new UUID(ByteString.copy(UUID))); - _fooUrnEBeanLocalAccess.add(alice, new AspectBar().setValue("32"), AspectBar.class, new AuditStamp()); // Alice 32 years old - _fooUrnEBeanLocalAccess.add(bob, new AspectBar().setValue("52"), AspectBar.class, new AuditStamp()); // Bob 52 years old - _fooUrnEBeanLocalAccess.add(jack, new AspectBar().setValue("16"), AspectBar.class, new AuditStamp()); // Jack 16 years old - _fooUrnEBeanLocalAccess.add(john, new AspectBar().setValue("42"), AspectBar.class, new AuditStamp()); // John 42 years old + _fooUrnEBeanLocalAccess.add(alice, new AspectBar().setValue("32"), AspectBar.class, new AuditStamp(), + new UUID(ByteString.copy(UUID))); // Alice 32 years old + + _fooUrnEBeanLocalAccess.add(bob, new AspectBar().setValue("52"), AspectBar.class, new AuditStamp(), + new UUID(ByteString.copy(UUID))); // Bob 52 years old + + _fooUrnEBeanLocalAccess.add(jack, new AspectBar().setValue("16"), AspectBar.class, new AuditStamp(), + new UUID(ByteString.copy(UUID))); // Jack 16 years old + + _fooUrnEBeanLocalAccess.add(john, new AspectBar().setValue("42"), AspectBar.class, new AuditStamp(), + new UUID(ByteString.copy(UUID))); // John 42 years old // Add Alice pair-with Jack relationships. Alice --> Jack. PairsWith alicePairsWithJack = new PairsWith().setSource(alice).setDestination(jack); @@ -358,7 +368,7 @@ public void testFindEntitiesOneHopAwayUndirected() throws Exception { @Test public void testFindOneEntityWithInCondition() throws URISyntaxException { // Ingest data - _fooUrnEBeanLocalAccess.add(new FooUrn(1), new AspectFoo().setValue("foo"), AspectFoo.class, new AuditStamp()); + _fooUrnEBeanLocalAccess.add(new FooUrn(1), new AspectFoo().setValue("foo"), AspectFoo.class, new AuditStamp(), new UUID(ByteString.copy(UUID))); // Prepare filter AspectField aspectField = new AspectField().setAspect(AspectFoo.class.getCanonicalName()).setPath("/value"); @@ -381,7 +391,7 @@ public void testFindOneEntityWithInCondition() throws URISyntaxException { @Test public void testFindNoEntityWithInCondition() throws URISyntaxException { // Ingest data - _fooUrnEBeanLocalAccess.add(new FooUrn(1), new AspectFoo().setValue("foo"), AspectFoo.class, new AuditStamp()); + _fooUrnEBeanLocalAccess.add(new FooUrn(1), new AspectFoo().setValue("foo"), AspectFoo.class, new AuditStamp(), new UUID(ByteString.copy(UUID))); // Prepare filter AspectField aspectField = new AspectField().setAspect(AspectFoo.class.getCanonicalName()).setPath("/value"); @@ -402,7 +412,7 @@ public void testFindNoEntityWithInCondition() throws URISyntaxException { @Test public void testFindEntitiesWithEmptyRelationshipFilter() throws URISyntaxException { // Ingest data - _fooUrnEBeanLocalAccess.add(new FooUrn(1), new AspectFoo().setValue("foo"), AspectFoo.class, new AuditStamp()); + _fooUrnEBeanLocalAccess.add(new FooUrn(1), new AspectFoo().setValue("foo"), AspectFoo.class, new AuditStamp(), new UUID(ByteString.copy(UUID))); // Create empty filter LocalRelationshipFilter emptyFilter = new LocalRelationshipFilter(); diff --git a/testing/test-models/src/main/java/com/linkedin/testing/TestUtils.java b/testing/test-models/src/main/java/com/linkedin/testing/TestUtils.java index 5860cdf1b..e6456495b 100644 --- a/testing/test-models/src/main/java/com/linkedin/testing/TestUtils.java +++ b/testing/test-models/src/main/java/com/linkedin/testing/TestUtils.java @@ -117,17 +117,4 @@ public static Set> getAllTestEntities() { } }); } - - /** - * Returns all test relationship classes. - */ - @Nonnull - public static Set> getAllTestRelationships() { - return Collections.unmodifiableSet(new HashSet>() { - { - add(RelationshipBar.class); - add(RelationshipFoo.class); - } - }); - } }