下面列出了com.google.common.collect.ImmutableList#of ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public Map<String, Configuration> loadAwsConfigurations() throws IOException {
List<String> awsFilenames =
ImmutableList.of(
"ElasticsearchDomains.json",
"SecurityGroups.json",
"Subnets.json",
"Vpcs.json",
"NetworkAcls.json",
"NetworkInterfaces.json",
"Reservations.json");
Batfish batfish =
BatfishTestUtils.getBatfishFromTestrigText(
TestrigText.builder()
.setAwsFiles("org/batfish/representation/aws/test", awsFilenames)
.build(),
_folder);
return batfish.loadConfigurations(batfish.getSnapshot());
}
protected RealAverageAggregation()
{
super(
new FunctionMetadata(
new Signature(
NAME,
ImmutableList.of(),
ImmutableList.of(),
REAL.getTypeSignature(),
ImmutableList.of(REAL.getTypeSignature()),
false),
true,
ImmutableList.of(new FunctionArgumentDefinition(false)),
false,
true,
"Returns the average value of the argument",
AGGREGATE),
true,
false);
}
@Test
public void testExoNativeInstall() throws Exception {
currentBuildState =
new ExoState(
"apk-content\n",
createFakeManifest("manifest-content\n"),
ImmutableList.of(),
ImmutableSortedMap.of(
"libs/" + SdkConstants.ABI_INTEL_ATOM + "/libone.so", "x86-libone\n",
"libs/" + SdkConstants.ABI_INTEL_ATOM + "/libtwo.so", "x86-libtwo\n",
"libs/" + SdkConstants.ABI_ARMEABI_V7A + "/libone.so", "armv7-libone\n",
"libs/" + SdkConstants.ABI_ARMEABI_V7A + "/libtwo.so", "armv7-libtwo\n"),
ImmutableList.of(),
ImmutableList.of());
checkExoInstall(1, 0, 2, 0, 0);
// This should be checked already, but do it explicitly here too to make it clear
// that we actually verify that the correct architecture libs are installed.
assertTrue(devicePathExists("native-libs/armeabi-v7a/metadata.txt"));
assertFalse(devicePathExists("native-libs/x86/metadata.txt"));
}
@Test
public void testInnerJoinPropagatesPredicatesViaEquiConditions()
{
Map<Symbol, ColumnHandle> leftAssignments = Maps.filterKeys(scanAssignments, Predicates.in(ImmutableList.of(A, B, C)));
TableScanNode leftScan = tableScanNode(leftAssignments);
Map<Symbol, ColumnHandle> rightAssignments = Maps.filterKeys(scanAssignments, Predicates.in(ImmutableList.of(D, E, F)));
TableScanNode rightScan = tableScanNode(rightAssignments);
FilterNode left = filter(leftScan, equals(AE, bigintLiteral(10)));
// predicates on "a" column should be propagated to output symbols via join equi conditions
PlanNode node = new JoinNode(
newId(),
JoinNode.Type.INNER,
left,
rightScan,
ImmutableList.of(new JoinNode.EquiJoinClause(A, D)),
ImmutableList.of(),
rightScan.getOutputSymbols(),
Optional.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty(),
ImmutableMap.of(),
Optional.empty());
Expression effectivePredicate = effectivePredicateExtractor.extract(SESSION, node, TypeProvider.empty(), typeAnalyzer);
assertEquals(
normalizeConjuncts(effectivePredicate),
normalizeConjuncts(equals(DE, bigintLiteral(10))));
}
@JsonCreator
protected MappableObject(
@JsonProperty("prop1") final String prop1,
@JsonProperty("prop1List") final List<String> prop1List
)
{
this.prop1 = prop1;
this.prop1List = prop1List == null ? ImmutableList.<String>of() : prop1List;
}
public static Collection<Asn1Tag> getPossibleFirstTags() {
if (TAG_ReferenceTime != null) {
return ImmutableList.of(TAG_ReferenceTime);
} else {
return Asn1Sequence.getPossibleFirstTags();
}
}
public static Collection<Asn1Tag> getPossibleFirstTags() {
if (TAG_BT_MeasurementElement_r13 != null) {
return ImmutableList.of(TAG_BT_MeasurementElement_r13);
} else {
return Asn1Sequence.getPossibleFirstTags();
}
}
public static Collection<Asn1Tag> getPossibleFirstTags() {
if (TAG_velocityRequestedType != null) {
return ImmutableList.of(TAG_velocityRequestedType);
} else {
return Asn1Null.getPossibleFirstTags();
}
}
private RowIndeterminateOperator()
{
super(INDETERMINATE,
ImmutableList.of(withVariadicBound("T", "row")),
ImmutableList.of(),
BOOLEAN.getTypeSignature(),
ImmutableList.of(new TypeSignature("T")),
false);
}
@Test
public void testMachinesObtainedInOrder() throws Exception {
List<String> ips = ImmutableList.of("1.1.1.1", "1.1.1.6", "1.1.1.3", "1.1.1.4", "1.1.1.5");
String spec = "byon(hosts=\""+Joiner.on(",").join(ips)+"\")";
MachineProvisioningLocation<MachineLocation> ll = resolve(spec);
for (String expected : ips) {
MachineLocation obtained = ll.obtain(ImmutableMap.of());
assertEquals(obtained.getAddress().getHostAddress(), expected);
}
}
public static Collection<Asn1Tag> getPossibleFirstTags() {
if (TAG_horizontalSpeedType != null) {
return ImmutableList.of(TAG_horizontalSpeedType);
} else {
return Asn1Integer.getPossibleFirstTags();
}
}
protected Builder(SearchTermViewServiceStubSettings settings) {
super(settings);
getSearchTermViewSettings = settings.getSearchTermViewSettings.toBuilder();
unaryMethodSettingsBuilders =
ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(getSearchTermViewSettings);
}
@Override
public List<RelReferentialConstraint> getReferentialConstraints() {
if (table != null) {
return table.getStatistic().getReferentialConstraints();
}
return ImmutableList.of();
}
@Test
public void testCompetingPackageDeclarationWithEqualCountsPicksDefault() {
mockInputStreamProvider
.addFile(
"/root/java/com/google/Bla.java", "package com.google.different;\n public class Bla {}")
.addFile("/root/java/com/google/Foo.java", "package com.google;\n public class Foo {}");
List<SourceArtifact> sourceArtifacts =
ImmutableList.of(
SourceArtifact.builder(TargetKey.forPlainTarget(LABEL))
.setArtifactLocation(
ArtifactLocation.builder()
.setRelativePath("java/com/google/Foo.java")
.setIsSource(true))
.build(),
SourceArtifact.builder(TargetKey.forPlainTarget(LABEL))
.setArtifactLocation(
ArtifactLocation.builder()
.setRelativePath("java/com/google/Bla.java")
.setIsSource(true))
.build());
ImmutableList<BlazeContentEntry> result =
sourceDirectoryCalculator.calculateContentEntries(
project,
context,
workspaceRoot,
decoder,
buildImportRoots(
ImmutableList.of(new WorkspacePath("java/com/google")), ImmutableList.of()),
sourceArtifacts,
NO_MANIFESTS);
issues.assertNoIssues();
assertThat(result)
.containsExactly(
BlazeContentEntry.builder("/root/java/com/google")
.addSource(
BlazeSourceDirectory.builder("/root/java/com/google")
.setPackagePrefix("com.google")
.build())
.build());
}
protected Builder(GroupPlacementViewServiceStubSettings settings) {
super(settings);
getGroupPlacementViewSettings = settings.getGroupPlacementViewSettings.toBuilder();
unaryMethodSettingsBuilders =
ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(getGroupPlacementViewSettings);
}
SchemaBoundStatement gteToken(final BackendKeyFilter.GTEToken clause) {
return new SchemaBoundStatement(columnToken + " >= ?", ImmutableList.of(clause.getToken()));
}
@Test(expected = ExceptionInInitializerError.class)
public void testBringMultipleStageLibsToFront() throws Exception {
List<URL> urls = ImmutableList.of(new URL("file:///tmp/bar-1.jar"), new URL("file:///tmp/bar-X-1.jar"));
Assert.assertEquals(urls, SDCClassLoader.bringStageAndProtoLibsToFront("bar", urls));
}
@Test
public void noTestAppSpecified() {
setProjectView(
"directories:",
" java/com/foo/app",
"targets:",
" //java/com/foo/app:instrumentation_test",
"android_sdk_platform: android-27");
MockSdkUtil.registerSdk(workspace, "27");
workspace.createFile(
new WorkspacePath("java/com/foo/app/MainActivity.java"),
"package com.foo.app",
"import android.app.Activity;",
"public class MainActivity extends Activity {}");
workspace.createFile(
new WorkspacePath("java/com/foo/app/Test.java"),
"package com.foo.app",
"public class Test {}");
setTargetMap(
android_binary("//java/com/foo/app:app").src("MainActivity.java"),
android_binary("//java/com/foo/app:test_app")
.src("Test.java")
.instruments("//java/com/foo/app:app"),
android_instrumentation_test("//java/com/foo/app:instrumentation_test"));
runFullBlazeSync();
MessageCollector messageCollector = new MessageCollector();
BlazeContext context = new BlazeContext();
context.addOutputSink(IssueOutput.class, messageCollector);
BlazeInstrumentationTestApkBuildStep buildStep =
new BlazeInstrumentationTestApkBuildStep(
getProject(),
Label.create("//java/com/foo/app:instrumentation_test"),
ImmutableList.of());
InstrumentorToTarget pair =
buildStep.getInstrumentorToTargetPair(
context, BlazeProjectDataManager.getInstance(getProject()).getBlazeProjectData());
assertThat(pair).isNull();
assertThat(messageCollector.getMessages()).hasSize(1);
assertThat(messageCollector.getMessages().get(0))
.contains(
"No \"test_app\" in target definition for //java/com/foo/app:instrumentation_test.");
}
@Override
public ImmutableList<RuleSet> requires() {
return ImmutableList.of();
}
@Override
public ImmutableList<String> outputDependenciesArgs(String outputPath) {
return ImmutableList.of();
}