コード例 #1
0
 public ArtifactCache createArtifactCache(
     Optional<String> currentWifiSsid, BuckEventBus buckEventBus) {
   ImmutableList<String> modes = getArtifactCacheModes();
   if (modes.isEmpty()) {
     return new NoopArtifactCache();
   }
   ImmutableList.Builder<ArtifactCache> builder = ImmutableList.builder();
   boolean useDistributedCache = isWifiUsableForDistributedCache(currentWifiSsid);
   try {
     for (String mode : modes) {
       switch (ArtifactCacheNames.valueOf(mode)) {
         case dir:
           ArtifactCache dirArtifactCache = createDirArtifactCache();
           buckEventBus.register(dirArtifactCache);
           builder.add(dirArtifactCache);
           break;
         case http:
           if (useDistributedCache) {
             ArtifactCache httpArtifactCache = createHttpArtifactCache(buckEventBus);
             builder.add(httpArtifactCache);
           }
           break;
       }
     }
   } catch (IllegalArgumentException e) {
     throw new HumanReadableException("Unusable cache.mode: '%s'", modes.toString());
   }
   ImmutableList<ArtifactCache> artifactCaches = builder.build();
   if (artifactCaches.size() == 1) {
     // Don't bother wrapping a single artifact cache in MultiArtifactCache.
     return artifactCaches.get(0);
   } else {
     return new MultiArtifactCache(artifactCaches);
   }
 }
コード例 #2
0
    /**
     * Constructor
     *
     * @param executable  File pointing at the PhantomJS executable.
     * @param port        Which port to start the PhantomJS/GhostDriver on.
     * @param args        The arguments to the launched server.
     * @param environment The environment for the launched server.
     * @throws java.io.IOException If an I/O error occurs.
     */
    private PhantomJSDriverService(File executable,
                                   int port,
                                   ImmutableList<String> args,
                                   ImmutableMap<String, String> environment) throws IOException {
        super(executable, port, args, environment);

        // Print out the parameters used to launch PhantomJS Driver Service
        LOG.info("executable: " + executable.getAbsolutePath());
        LOG.info("port: " + port);
        LOG.info("arguments: " + args.toString());
        LOG.info("environment: " + environment.toString());
    }
コード例 #3
0
  /**
   * Starts the defined appium server
   *
   * @throws AppiumServerHasNotBeenStartedLocallyException If an error occurs while spawning the
   *     child process.
   * @see #stop()
   */
  public void start() throws AppiumServerHasNotBeenStartedLocallyException {
    lock.lock();
    try {
      if (isRunning()) {
        return;
      }

      try {
        process =
            new CommandLine(
                this.nodeJSExec.getCanonicalPath(), nodeJSArgs.toArray(new String[] {}));
        process.setEnvironmentVariables(nodeJSEnvironment);
        process.copyOutputTo(stream);
        process.executeAsync();
        ping(startupTimeout, timeUnit);
      } catch (Throwable e) {
        destroyProcess();
        String msgTxt =
            "The local appium server has not been started. "
                + "The given Node.js executable: "
                + this.nodeJSExec.getAbsolutePath()
                + " Arguments: "
                + nodeJSArgs.toString()
                + " "
                + "\n";
        if (process != null) {
          String processStream = process.getStdOut();
          if (!StringUtils.isBlank(processStream))
            msgTxt = msgTxt + "Process output: " + processStream + "\n";
        }

        throw new AppiumServerHasNotBeenStartedLocallyException(msgTxt, e);
      }
    } finally {
      lock.unlock();
    }
  }
コード例 #4
0
ファイル: Suffix.java プロジェクト: batali/latin
 public String toString() {
   return spec.toString() + ":" + alts.toString();
 }
コード例 #5
0
ファイル: MovePair.java プロジェクト: rinde/RinLog
 @Override
 public String toString() {
   return "MovePair{" + changesets.toString() + "}";
 }