Package org.apache.twill.api

Examples of org.apache.twill.api.TwillRunner.prepare()


  private static final Logger LOG = LoggerFactory.getLogger(SessionExpireTestRun.class);

  @Test
  public void testAppSessionExpire() throws InterruptedException, ExecutionException {
    TwillRunner runner = YarnTestUtils.getTwillRunner();
    TwillController controller = runner.prepare(new SleepRunnable(600))
                                       .addLogHandler(new PrinterLogHandler(new PrintWriter(System.out, true)))
                                       .start();

    final CountDownLatch runLatch = new CountDownLatch(1);
    controller.addListener(new ServiceListenerAdapter() {
View Full Code Here


public class ContainerSizeTestRun extends BaseYarnTest {

  @Test
  public void testContainerSize() throws InterruptedException {
    TwillRunner runner = YarnTestUtils.getTwillRunner();
    TwillController controller = runner.prepare(new SleepApp())
      .addLogHandler(new PrinterLogHandler(new PrintWriter(System.out, true)))
      .start();

    try {
      ServiceDiscovered discovered = controller.discoverService("sleep");
View Full Code Here

public final class ServiceDiscoveryTestRun extends BaseYarnTest {

  @Test
  public void testServiceDiscovery() throws InterruptedException, ExecutionException, TimeoutException {
    TwillRunner twillRunner = YarnTestUtils.getTwillRunner();
    TwillController controller = twillRunner
      .prepare(new ServiceApplication())
      .addLogHandler(new PrinterLogHandler(new PrintWriter(System.out, true)))
      .withArguments("r1", "12345")
      .withArguments("r2", "45678")
      .start();
View Full Code Here

    String header = Files.readFirstLine(new File(getClass().getClassLoader().getResource("header.txt").toURI()),
                                        Charsets.UTF_8);

    TwillRunner runner = YarnTestUtils.getTwillRunner();

    TwillController controller = runner.prepare(new LocalFileApplication())
      .addJVMOptions(" -verbose:gc -Xloggc:gc.log -XX:+PrintGCDetails")
      .withApplicationArguments("local")
      .withArguments("LocalFileSocketServer", "local2")
      .addLogHandler(new PrinterLogHandler(new PrintWriter(System.out, true)))
      .start();
View Full Code Here

  @Test
  public void testEchoServer() throws InterruptedException, ExecutionException, IOException,
    URISyntaxException, TimeoutException {
    TwillRunner runner = YarnTestUtils.getTwillRunner();

    TwillController controller = runner.prepare(new EchoServer(),
                                                ResourceSpecification.Builder.with()
                                                         .setVirtualCores(1)
                                                         .setMemory(1, ResourceSpecification.SizeUnit.GIGA)
                                                         .setInstances(2)
                                                         .build())
View Full Code Here

        }
      }
    };

    TwillRunner runner = YarnTestUtils.getTwillRunner();
    TwillController controller = runner.prepare(new LogRunnable())
                                       .addLogHandler(new PrinterLogHandler(new PrintWriter(System.out, true)))
                                       .addLogHandler(logHandler)
                                       .start();

    Services.getCompletionFuture(controller).get();
View Full Code Here

    ResourceSpecification resource = ResourceSpecification.Builder.with()
      .setVirtualCores(1)
      .setMemory(512, ResourceSpecification.SizeUnit.MEGA)
      .setInstances(2)
      .build();
    TwillController controller = runner.prepare(new FailureRunnable(), resource)
      .withApplicationArguments("failure")
      .withArguments(FailureRunnable.class.getSimpleName(), "failure2")
      .addLogHandler(new PrinterLogHandler(new PrintWriter(System.out, true)))
      .start();
View Full Code Here

    ResourceSpecification resourceSpec = ResourceSpecification.Builder.with()
      .setVirtualCores(1)
      .setMemory(2048, ResourceSpecification.SizeUnit.MEGA)
      .setInstances(1)
      .build();
    TwillController controller = runner.prepare(new EnvironmentEchoServer(), resourceSpec)
      .addLogHandler(new PrinterLogHandler(new PrintWriter(System.out, true)))
      .withApplicationArguments("envecho")
      .withArguments("EnvironmentEchoServer", "echo2")
      .start();
View Full Code Here

    ResourceSpecification resourceSpec = ResourceSpecification.Builder.with()
      .setVirtualCores(1)
      .setMemory(128, ResourceSpecification.SizeUnit.MEGA)
      .setInstances(2)
      .build();
    TwillController controller = runner.prepare(new BuggyServer(), resourceSpec)
      .addLogHandler(new PrinterLogHandler(new PrintWriter(System.out, true)))
      .withApplicationArguments("echo")
      .withArguments("BuggyServer", "echo2")
      .start();
View Full Code Here

  @Test
  public void testResourceReport() throws InterruptedException, ExecutionException, IOException,
    URISyntaxException, TimeoutException {
    TwillRunner runner = YarnTestUtils.getTwillRunner();

    TwillController controller = runner.prepare(new ResourceApplication())
                                        .addLogHandler(new PrinterLogHandler(new PrintWriter(System.out, true)))
                                        .withApplicationArguments("echo")
                                        .withArguments("echo1", "echo1")
                                        .withArguments("echo2", "echo2")
                                        .start();
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.