Repository navigation
Expand file tree
/
Copy pathPalantirDeeplyNestedCalls.java
More file actions
93 lines (91 loc) · 6.2 KB
/
Copy pathPalantirDeeplyNestedCalls.java
File metadata and controls
93 lines (91 loc) · 6.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
class PalantirDeeplyNestedCalls {
private static MagicConfigV1 testSheetV1 = MagicConfigV1.builder()
.foooos(ImmutableList.of(testFieldOneV1))
.baaars(ImmutableList.of(MagicConfigV1.builder()
.foooos(ImmutableList.of(testFieldTwoV1, testFieldThreeV1))
.baaars(ImmutableList.of(MagicConfigV1.builder()
.baaars(ImmutableList.of(MagicConfigV1.builder()
.baaars(ImmutableList.of(MagicConfigV1.builder()
.foooos(ImmutableList.of(testFieldFourV1))
.build()))
.build()))
.build()))
.build()))
.build();
void testMethod() {
assertThat(ConfigServiceV1.getAllItems(item1, item2, item3, item4))
.containsExactlyInAnyOrderElementsOf(Set.of(
new ItemWithCustomLocator(
ItemConfigV1.DEFAULT_CONFIG.toCustomString(),
ItemConfigV1.createCustomConfig(ItemConfigV1Locator.of(TEST_ITEM_A))),
new ItemWithCustomLocator(
ItemConfigV1.builder()
.id(getId(TEST_ITEM_A))
.name(ItemName.of(TEST_API_NAME.get()))
.apiName(TEST_API_NAME)
.spec(ItemConfigV1Spec.native_(NativeItemConfigV1Spec.model(TestModel.of())))
.category(TestCatalog.TEST_CATEGORY_ALPHA)
.creator(TestCatalog.TEST_CREATOR_BETA)
.status(ItemLifecycleStatus.EXPERIMENTAL)
.statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of()))
.inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of()))
.creationDate(ItemMetadataInfo.builder().build())
.performanceAttributes(
ItemAttributes.builder().build())
.categories(TestCatalog.TEST_CATEGORY_ALPHA)
.build(),
CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_B))),
new ItemWithCustomLocator(
ItemConfigV1.builder()
.id(getId(TestModelCatalog.MODEL_XYZ_123.apiName()))
.name(ItemName.of(TestModelCatalog.MODEL_XYZ_123
.apiName()
.get()))
.apiName(TestModelCatalog.MODEL_XYZ_123.apiName())
.spec(ItemConfigV1Spec.native_(
NativeItemConfigV1Spec.hubModel(HubModelSpec.of())))
.category(TestCatalog.TEST_CATEGORY_ALPHA)
.creator(TestCatalog.TEST_CREATOR_BETA)
.status(ItemLifecycleStatus.EXPERIMENTAL)
.statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of()))
.inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of()))
.creationDate(ItemMetadataInfo.builder().build())
.performanceAttributes(
ItemAttributes.builder().build())
.categories(TestCatalog.TEST_CATEGORY_ALPHA)
.build(),
CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_C))),
// Discovered items
new ItemWithCustomLocator(
TestModelCatalog.MODEL_ABC_456.toItemApi(),
CustomItemLocator.discovered(DiscoveredItemLocator.of())),
new ItemWithCustomLocator(
ItemConfigV1.builder()
.id(getId(TEST_API_NAME))
.name(ItemName.of(TEST_API_NAME.get()))
.apiName(TEST_API_NAME)
.spec(ItemConfigV1Spec.native_(
NativeItemConfigV1Spec.hubModel(HubModelSpec.of())))
.category(TestCatalog.TEST_CATEGORY_ALPHA)
.creator(TestCatalog.TEST_CREATOR_BETA)
.status(ItemLifecycleStatus.EXPERIMENTAL)
.statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of()))
.inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of()))
.creationDate(ItemMetadataInfo.builder().build())
.performanceAttributes(
ItemAttributes.builder().build())
.categories(TestCatalog.TEST_CATEGORY_ALPHA)
.build(),
CustomItemLocator.discovered(DiscoveredItemLocator.of()))));
}
public Map<FooBarRid, BazQuxMetrics> otherMethod(
FooAuthHeader authHeader, Set<FooBarRid> thingRids, WidgetTimeRange timeRange) {
return myCustomService
.get()
.fetchData(authHeader, FooMyCustomClass.of(thingRids, timeRange))
.entrySet()
.stream()
.collect(Collectors.toMap(
Map.Entry::getKey, entry -> entry.getValue().getMetrics()));
}
}