コード例 #1
0
 @Override
 public DeploymentPackager getPackager() {
   if (archiveHolderInst.get() == null) {
     archiveHolderInst.set(new ServiceArchiveHolder());
   }
   return new JMXProtocolPackager(archiveHolderInst.get());
 }
コード例 #2
0
 private void configure(ArquillianDescriptor arquillianDescriptor) {
   operatingSystemFamilyInstanceProducer.set(
       new OperatingSystemResolver().currentOperatingSystem().getFamily());
   Map<String, String> config =
       arquillianDescriptor.extension(EXTENSION_NAME).getExtensionProperties();
   config = resolveSystemEnvironmentVariables(config);
   config = resolveAutoStartDockerMachine(config);
   config = resolveDefaultDockerMachine(config);
   config = resolveServerUriByOperativeSystem(config);
   config = resolveServerUriTcpProtocol(config);
   config = resolveServerIp(config);
   CubeDockerConfiguration cubeConfiguration = CubeDockerConfiguration.fromMap(config);
   System.out.println(cubeConfiguration);
   hostUriContextInstanceProducer.set(new HostUriContext(cubeConfiguration.getDockerServerUri()));
   configurationProducer.set(cubeConfiguration);
 }
コード例 #3
0
 private void execute(EventContext<? extends ExecutionEvent> context, String phase) {
   if (shouldPerformExecution(context.getEvent())) {
     context.proceed();
   } else {
     log.info("Ignore test [" + phase + "]: " + toFqn(context.getEvent()));
     testResultProducer.set(new TestResult(TestResult.Status.SKIPPED));
   }
 }
コード例 #4
0
  /**
   * Creates all resources related to this container after its start so we can further use them by
   * injection points.
   *
   * @param event
   */
  public void onAfterContainerStart(@Observes AfterStart event) {
    if (event.getDeployableContainer().getConfigurationClass()
        == AndroidContainerConfiguration.class) {
      activityDeploymentMapper.set(getActivityDeploymentMapper());
      activityWebDriverMapper.set(getActivityWebDriverMapper());
      extensionDroneMapper.set(getWebDriverPortMapper());
      deploymentWebDriverMapper.set(getDeploymentWebDriverMapper());
      deploymentInstrumentationMapper.set(getDeploymentInstrumentationMapper());

      selendroidServerManager.set(getSelendroidServerManager());
      selendroidRebuilder.set(getSelendroidRebuilder());
      selendroidDeploymentRegister.set(new SelendroidDeploymentRegister());

      NativeActivityManager activityManager =
          new NativeActivityManager(activityWebDriverMapper.get());
      androidDevice.get().getActivityManagerProvider().setActivityManager(activityManager);
    }
  }
コード例 #5
0
 private Map<String, String> resolveServerUriByOperativeSystem(
     Map<String, String> cubeConfiguration) {
   if (!cubeConfiguration.containsKey(CubeDockerConfiguration.DOCKER_URI)) {
     if (isDockerMachineSet(cubeConfiguration)) {
       String serverUri = OperatingSystemFamily.MACHINE.getServerUri();
       cubeConfiguration.put(CubeDockerConfiguration.DOCKER_URI, serverUri);
     } else {
       OperatingSystemFamily operatingSystemFamily = operatingSystemFamilyInstanceProducer.get();
       String serverUri = operatingSystemFamily.getServerUri();
       cubeConfiguration.put(CubeDockerConfiguration.DOCKER_URI, serverUri);
     }
   }
   return cubeConfiguration;
 }
コード例 #6
0
 public void updateTestContextWithAppServerInfo(@Observes(precedence = 1) BeforeClass event) {
   testContext = testContextProducer.get();
   String appServerQualifier = getAppServerQualifier(testContext.getTestClass());
   for (ContainerInfo container : testContext.getSuiteContext().getContainers()) {
     if (container.getQualifier().equals(appServerQualifier)) {
       testContext.setAppServerInfo(updateWithAppServerInfo(container));
     }
   }
   // validate app server
   if (appServerQualifier != null && testContext.getAppServerInfo() == null) {
     throw new RuntimeException(
         String.format(
             "No app server container matching '%s' was activated. Check if defined and enabled in arquillian.xml.",
             appServerQualifier));
   }
   log.info("\n\n" + testContext);
 }
コード例 #7
0
 /** Stops the Event Bus */
 void stopEventBus(@Observes StopBus event) {
   CommandBusOnClient bus = commandBusInst.get();
   bus.stopBus();
 }
コード例 #8
0
 void startEventBus(@Observes StartBus event) throws Exception {
   CommandBusOnClient bus = new CommandBusOnClient();
   injector.get().inject(bus);
   commandBusInst.set(bus);
   bus.startBus(event);
 }
 public void configure(@Observes BeforeSuite beforeSuiteEvent) {
   ConfigurationImporter extractor = new ConfigurationImporter();
   Seam2Configuration configuration = extractor.from(descriptor.get());
   configurationProducer.set(configuration);
 }
 private Context createContext() throws Exception {
   if (contextInst.get() == null) {
     contextInst.set(new InitialContext());
   }
   return contextInst.get();
 }
コード例 #11
0
  public void createAndroidVirtualDeviceAvailable(
      @Observes AndroidVirtualDeviceEvent event,
      AndroidBridge bridge,
      AndroidExtensionConfiguration configuration,
      AndroidSdk sdk,
      ProcessExecutor executor)
      throws AndroidExecutionException {

    if (!bridge.isConnected()) {
      throw new IllegalStateException(
          "Android debug bridge must be connected in order to spawn emulator");
    }

    String name = configuration.getAvdName();
    AndroidDevice running = null;
    for (AndroidDevice device : bridge.getDevices()) {
      if (equalsIgnoreNulls(name, device.getAvdName())) {
        running = device;
        break;
      }
    }

    if (running == null) {

      CountDownWatch countdown =
          new CountDownWatch(configuration.getEmulatorBootupTimeoutInSeconds(), TimeUnit.SECONDS);
      log.log(
          Level.INFO,
          "Waiting {0} seconds for emulator {1} to be started and connected.",
          new Object[] {countdown.timeout(), name});

      // discover what device was added here
      DeviceConnectDiscovery deviceDiscovery = new DeviceConnectDiscovery();
      AndroidDebugBridge.addDeviceChangeListener(deviceDiscovery);

      Process emulator = startEmulator(executor, sdk, name, configuration.getEmulatorOptions());
      androidEmulator.set(new AndroidEmulator(emulator));

      log.log(
          Level.FINE,
          "Emulator process started, {0} seconds remaining to start the device {1}",
          new Object[] {countdown.timeLeft(), name});

      waitUntilBootUpIsComplete(deviceDiscovery, executor, sdk, countdown);
      running = deviceDiscovery.getDiscoveredDevice();

      AndroidDebugBridge.removeDeviceChangeListener(deviceDiscovery);

    } else {
      log.info(
          "Emulator for device "
              + name
              + " is already started, device serial is "
              + running.getSerialNumber()
              + ". Emulator will not be reinitialized.");
    }

    // fire event that we have a device ready
    androidDevice.set(running);
    androidDeviceReady.fire(new AndroidDeviceReady(running));
  }
コード例 #12
0
    public void overrideBefore(@Observes EventContext<BeforeClass> event) {
      // Don't continue TestClass's BeforeClass context as normal.
      // No DeploymentGeneration or Deploy will take place.

      classDeploymentScenario.set(suiteDeploymentScenario);
    }