|
1 | 1 | package com.linkedin.metadata.restli;
|
2 | 2 |
|
| 3 | +import com.google.common.collect.ImmutableList; |
3 | 4 | import com.google.common.collect.ImmutableMap;
|
4 | 5 | import com.google.common.collect.ImmutableSet;
|
5 | 6 | import com.linkedin.data.template.StringArray;
|
|
15 | 16 | import com.linkedin.testing.urn.BarUrn;
|
16 | 17 | import com.linkedin.testing.urn.FooUrn;
|
17 | 18 | import java.util.Arrays;
|
| 19 | +import java.util.Collection; |
18 | 20 | import java.util.Collections;
|
19 | 21 | import java.util.HashSet;
|
20 | 22 | import java.util.List;
|
@@ -144,6 +146,26 @@ public void testBackfillMAEEmptyBackfillResult() {
|
144 | 146 | verify(_fooLocalDAO, times(3)).backfillMAE(any(), any(), any());
|
145 | 147 | }
|
146 | 148 |
|
| 149 | + @Test |
| 150 | + public void testBackfillMAEFilterEmptyAspectUrn() { |
| 151 | + TestResource testResource = new TestResource(); |
| 152 | + Set<String> urnSet = ImmutableSet.of(makeFooUrn(1).toString(), makeFooUrn(2).toString()); |
| 153 | + when(_fooLocalDAO.backfillMAE(BackfillMode.BACKFILL_INCLUDING_LIVE_INDEX, null, Collections.singleton(makeFooUrn(1).toString()))) |
| 154 | + .thenReturn(ImmutableMap.of(makeFooUrn(1).toString(), multiAspectsSet)); |
| 155 | + BackfillItem[] result = runAndWait(testResource.backfillMAE(provideBackfillItems(urnSet, null), IngestionMode.BACKFILL)); |
| 156 | + assertEqualBackfillItemArrays(result, provideBackfillItems(ImmutableSet.of(makeFooUrn(1).toString()), multiAspectsSet)); |
| 157 | + } |
| 158 | + |
| 159 | + @Test |
| 160 | + public void testBackfillMAEDuplicateUrn() { |
| 161 | + TestResource testResource = new TestResource(); |
| 162 | + List<String> urnList = ImmutableList.of(makeFooUrn(1).toString(), makeFooUrn(1).toString()); |
| 163 | + when(_fooLocalDAO.backfillMAE(BackfillMode.BACKFILL_INCLUDING_LIVE_INDEX, null, Collections.singleton(makeFooUrn(1).toString()))) |
| 164 | + .thenReturn(ImmutableMap.of(makeFooUrn(1).toString(), multiAspectsSet)); |
| 165 | + BackfillItem[] result = runAndWait(testResource.backfillMAE(provideBackfillItems(urnList, null), IngestionMode.BACKFILL)); |
| 166 | + assertEqualBackfillItemArrays(result, provideBackfillItems(ImmutableList.of(makeFooUrn(1).toString(), makeFooUrn(1).toString()), multiAspectsSet)); |
| 167 | + } |
| 168 | + |
147 | 169 | @Test
|
148 | 170 | public void testBackfillMAENoSuchEntity() {
|
149 | 171 | TestResource testResource = new TestResource();
|
@@ -186,7 +208,7 @@ public void testBackfillMAEException() {
|
186 | 208 | assertEqualBackfillItemArrays(result, expectedItems);
|
187 | 209 | }
|
188 | 210 |
|
189 |
| - private BackfillItem[] provideBackfillItems(Set<String> urnSet, Set<String> aspects) { |
| 211 | + private BackfillItem[] provideBackfillItems(Collection<String> urnSet, Set<String> aspects) { |
190 | 212 | return urnSet.stream().map(urn -> {
|
191 | 213 | BackfillItem item = new BackfillItem();
|
192 | 214 | item.setUrn(urn);
|
|
0 commit comments