Package org.apache.twill.filesystem

Examples of org.apache.twill.filesystem.Location.toURI()


          location = copyFromURL(url, createTempLocation(Paths.appendSuffix(url.getFile(), localFile.getName())));
          LOG.debug("Done {} : {}", runnableName, url);
        }

        localFiles.put(runnableName,
                       new DefaultLocalFile(localFile.getName(), location.toURI(), location.lastModified(),
                                            location.length(), localFile.isArchive(), localFile.getPattern()));
      }
    }
    LOG.debug("Done Runnable LocalFiles");
  }
View Full Code Here


    //Starting health monitor service
    healthInspector.startAndWait();

    //Initializing methodsDriver
    Map<String, StreamSchema> schemaMap = MetaInformationParser.getSchemaMap(new File(binDir.toURI()));
    methodsDriver = new MethodsDriver(this, schemaMap);

    //Initialize stopwatch and retry counter
    stopwatch = new Stopwatch();
    retryCounter = 0;
View Full Code Here

    //Create directory structure to place the Stream Engine Config Files
    Location workDir = dir.append("work");
    workDir.mkdirs();
    Location queryDir = workDir.append("query");
    queryDir.mkdirs();
    File qDir = new File(queryDir.toURI().getPath());
    FileUtils.copyFileToDirectory(new File(dir.append("cfg").append("external_fcns.def").toURI().getPath()), qDir);
    FileUtils.copyFileToDirectory(new File(dir.append("cfg").append("internal_fcn.def").toURI().getPath()), qDir);
    return queryDir;
  }
View Full Code Here

  protected static FlowManager deployFlow(Class<? extends Flow> flowClz, Map<String, String> runtimeArgs,
                                   File...bundleEmbeddedJars) {
    Preconditions.checkNotNull(flowClz, "Flow class cannot be null");
    try {
      Location deployJar = deployClient.jarForTestBase(flowClz, bundleEmbeddedJars);
      ProgramController controller = deployClient.startFlow(new File(deployJar.toURI()), flowClz.getName(),
                                                            tmpFolder.newFolder(), runtimeArgs);
      return new DefaultFlowManager(controller);
    } catch (Exception e) {
      throw Throwables.propagate(e);
    }
View Full Code Here

      String flowletName = entry.getKey();
      flowletNames.add(flowletName);
      runnableSetter = moreRunnable
        .add(flowletName, new FlowletTwillRunnable(flowletName, "hConf.xml", "cConf.xml"), resourceSpec)
        .withLocalFiles().add(programName, programLocation.toURI())
                         .add("hConf.xml", hConfig.toURI())
                         .add("cConf.xml", cConfig.toURI()).apply();
    }

    Preconditions.checkState(runnableSetter != null, "No flowlet for the flow.");
View Full Code Here

      throw new Exception("Expected Flow class");
    }
    ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
    Thread.currentThread().setContextClassLoader(classLoader);
    Location deployJar = jarForTestBase(clz);
    LOG.info("Deloy Jar location : {}", deployJar.toURI());
    try {
      return Programs.create(deployJar, classLoader);
    } finally {
      Thread.currentThread().setContextClassLoader(contextClassLoader);
    }
View Full Code Here

  public Location jarForTestBase(Class<?> flowClz, File... bundleEmbeddedJars)
    throws Exception {
    Preconditions.checkNotNull(flowClz, "Flow cannot be null.");
    Location deployedJar = locationFactory.create(createDeploymentJar(
      locationFactory, flowClz, bundleEmbeddedJars).toURI());
    LOG.info("Created deployedJar at {}", deployedJar.toURI().toASCIIString());
    return deployedJar;
  }

  private static InputSupplier<InputStream> getInputSupplier(final FlowSpecification flowSpec) {
    return new InputSupplier<InputStream>() {
View Full Code Here

      ByteStreams.copy(getInputSupplier(flowSpec), jarOutput);
    } finally {
      jarOutput.close();
    }

    return new File(deployJar.toURI());
  }

}
View Full Code Here

    Location accountAppsLocation = allAppsLocation.append(id.getAccountId());
    String name = String.format(Locale.ENGLISH, "%s/%s", type.toString(), id.getApplicationId());
    Location applicationProgramsLocation = accountAppsLocation.append(name);
    if (!applicationProgramsLocation.exists()) {
      throw new FileNotFoundException("Unable to locate the Program,  location doesn't exist: "
                                   + applicationProgramsLocation.toURI().getPath());
    }
    Location programLocation = applicationProgramsLocation.append(String.format("%s.jar", id.getId()));
    if (!programLocation.exists()) {
      throw new FileNotFoundException(String.format("Program %s.%s of type %s does not exists.",
                                               id.getApplication(), id.getId(), type));
View Full Code Here

    Preconditions.checkNotNull(applicationClz, "Application cannot be null.");

    Location deployedJar =
      locationFactory.create(createDeploymentJar(locationFactory, applicationClz, bundleEmbeddedJars).toURI());
    LOG.info("Created deployedJar at {}", deployedJar.toURI().toASCIIString());

    DefaultHttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, "/v2/apps");
    request.setHeader(Constants.Gateway.API_KEY, "api-key-example");
    request.setHeader("X-Archive-Name", applicationId + ".jar");
    MockResponder mockResponder = new MockResponder();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.