Example usage for com.google.common.collect ImmutableList of

List of usage examples for com.google.common.collect ImmutableList of

Introduction

In this page you can find the example usage for com.google.common.collect ImmutableList of.

Prototype

public static <E> ImmutableList<E> of(E e1, E e2, E e3) 

Source Link

Usage

From source file:com.facebook.buck.apple.CodeSigning.java

/**
 * Checks whether a binary or bundle already has a valid code signature.
 *
 * @param path Resolved path to the binary or bundle.
 * @return Whether the binary or bundle has a valid code signature.
 *///from  w  w  w . j a  va2s .  c o  m
public static boolean hasValidSignature(ProcessExecutor processExecutor, Path path)
        throws InterruptedException, IOException {
    ProcessExecutorParams processExecutorParams = ProcessExecutorParams.builder()
            .setCommand(ImmutableList.of("codesign", "-vvvv", path.toString())).build();

    // Specify that stdout is expected, or else output may be wrapped in Ansi escape chars.
    Set<ProcessExecutor.Option> options = EnumSet.of(ProcessExecutor.Option.EXPECTING_STD_OUT,
            ProcessExecutor.Option.IS_SILENT);

    ProcessExecutor.Result result = processExecutor.launchAndExecute(processExecutorParams, options,
            /* stdin */ Optional.empty(), /* timeOutMs */ Optional.empty(),
            /* timeOutHandler */ Optional.empty());

    return result.getExitCode() == 0 && result.getStderr().isPresent()
            && result.getStderr().get().contains(": satisfies its Designated Requirement");
}

From source file:io.airlift.json.Person.java

public static void validatePersonListJsonCodec(JsonCodec<List<Person>> jsonCodec) {
    ImmutableList<Person> expected = ImmutableList.of(new Person().setName("dain").setRocks(true),
            new Person().setName("martin").setRocks(true), new Person().setName("mark").setRocks(true));

    String json = jsonCodec.toJson(expected);
    assertEquals(jsonCodec.fromJson(json), expected);

    byte[] bytes = jsonCodec.toJsonBytes(expected);
    assertEquals(jsonCodec.fromJson(bytes), expected);
}

From source file:org.sonar.plugins.jproperties.issuesaver.CrossFileChecksIssueSaver.java

private static Collection<Class<? extends CrossFileCheckIssueSaver>> getCrossFileCheckIssueSavers() {
    return ImmutableList.of(DuplicatedKeysAcrossFilesCheckIssueSaver.class,
            MissingTranslationsCheckIssueSaver.class, MissingTranslationsInDefaultCheckIssueSaver.class);
}

From source file:io.airlift.json.ImmutablePerson.java

public static void validatePersonListJsonCodec(JsonCodec<List<ImmutablePerson>> jsonCodec) {
    ImmutableList<ImmutablePerson> expected = ImmutableList.of(new ImmutablePerson("dain", true),
            new ImmutablePerson("martin", true), new ImmutablePerson("mark", true));

    String json = jsonCodec.toJson(expected);
    assertEquals(jsonCodec.fromJson(json), expected);

    byte[] bytes = jsonCodec.toJsonBytes(expected);
    assertEquals(jsonCodec.fromJson(bytes), expected);
}

From source file:com.google.devtools.moe.client.options.OptionsModule.java

@Provides
@Nullable//from  w  w w. j av a 2  s .c o m
@Argument("config_file")
static String configFile(String... args) {
    // TODO(cgruber) Migrate to JCommander, so we don't have to manually parse some of these.
    List<String> matchingArgs = ImmutableList.of("-c", "--config", "--config_file");
    for (int i = 0; i < args.length; i++) {
        if (matchingArgs.contains(args[i])) {
            if ((i + 1) >= args.length) {
                throw new IllegalArgumentException("'" + args[i] + "' specified without a parameter");
            }
            if (args[i + 1].startsWith("-")) {
                throw new IllegalArgumentException("'" + args[i] + "' is not followed by a path");
            }
            return args[i + 1];
        }
        // check for "--config=" style.
        for (String prefix : matchingArgs) {
            if (args[i].startsWith(prefix + "=")) {
                return args[i].substring(prefix.length() + 1);
            }
        }
    }
    // Some commands may not require config
    // TODO(cgruber) make this not-nullable when only config-requiring commands yank in the config.
    return null;
}

From source file:com.spectralogic.ds3autogen.test.helpers.SplitConverterTestHelper.java

/**
 * Creates a populated list of Ds3ResponseTypes, where one response type is typical, another has
 * a typename with a '$' character in it, and the final has a component type.
 *///from  w w w.  j  a v a2s. co  m
public static ImmutableList<Ds3ResponseType> getPopulatedDs3ResponseTypeList() {
    return ImmutableList.of(
            new Ds3ResponseType("com.spectralogic.s3.common.dao.domain.tape.TapePartition", null),
            new Ds3ResponseType(
                    "com.spectralogic.s3.server.handler.reqhandler.spectrads3.tape.GetTapePartitionRequestHandler$DetailedTapePartition",
                    null),
            new Ds3ResponseType("array", "com.spectralogic.s3.common.dao.domain.tape.TapePartition"));
}

From source file:com.google.api.services.samples.dfareporting.targeting.CreateTargetingTemplate.java

public static void runExample(Dfareporting reporting, long profileId, String templateName, long advertiserId)
        throws Exception {
    // Create the targeting template.
    TargetingTemplate template = new TargetingTemplate();
    template.setAdvertiserId(advertiserId);
    template.setName(templateName);/*w  w w.j a  v a2  s. c  om*/

    // Configure the template to serve ads on Monday, Wednesday, and Friday from 9-10am and 3-5pm.
    DayPartTargeting dayTargeting = new DayPartTargeting();
    dayTargeting.setDaysOfWeek(ImmutableList.of("MONDAY", "WEDNESDAY", "FRIDAY"));
    dayTargeting.setHoursOfDay(ImmutableList.of(9, 15, 16));
    dayTargeting.setUserLocalTime(true);
    template.setDayPartTargeting(dayTargeting);

    // Insert the targeting template.
    TargetingTemplate result = reporting.targetingTemplates().insert(profileId, template).execute();

    // Display the new targeting template ID.
    System.out.printf("Targeting template with ID %d was created.%n", result.getId());
}

From source file:com.spectralogic.ds3contractcomparator.print.utils.Ds3ObjectFixture.java

public static ImmutableList<Ds3Param> getOldParamList() {
    return ImmutableList.of(DELETED_PARAM, NO_CHANGE_PARAM, OLD_PARAM);
}

From source file:com.android.tools.idea.uibuilder.handlers.CheckedTextViewHandler.java

@Override
@NotNull
public List<String> getInspectorProperties() {
    return ImmutableList.of(ATTR_CHECK_MARK, ATTR_CHECK_MARK_TINT, ATTR_CHECKED);
}

From source file:com.android.tools.idea.uibuilder.handlers.NestedScrollViewHandler.java

@Override
@NotNull
public List<String> getInspectorProperties() {
    return ImmutableList.of(ATTR_CONTEXT, ATTR_SHOW_IN, ATTR_CLIP_TO_PADDING);
}