예제 #1
0
  /**
   * Returns the context with the given name. Contexts have to be loaded with {@link
   * #loadContexts()} or {@link #loadContexts(Set)} beforehand.
   *
   * @param contextName
   * @return Context with the given name.
   * @throws IllegalArgumentException If no context with the given name is available.
   */
  public TestContext getTestContext(String contextName) {
    OS osName = OS.current();
    Arch osArch = Arch.current();

    TestContext testContext =
        testContexts.loadFromTree(
            Arrays.asList(new String[] {contextName, osName.toString(), osArch.toString()})
                .iterator());

    if (null == testContext) {
      throw new IllegalArgumentException("No context with this name available: " + contextName);
    }

    return testContext;
  }
예제 #2
0
  /**
   * Returns the default context for the current operating system and architecture. The
   * corresponding file name has to be of the form endtoend.*os*.*arch*.properties. For possible
   * values of *os* and *arch* see the classes {@link OS} and {@link Arch}. Contexts have to be
   * loaded with {@link #loadContexts()} or {@link #loadContexts(Set)} beforehand.
   *
   * @return Default context for the current operating system and architecture.
   * @throws IllegalStateException If no context for the current operating system and architecture
   *     is available.
   */
  public TestContext getDefaultTestContext() {
    OS osName = OS.current();
    Arch osArch = Arch.current();

    TestContext testContext =
        testContexts.loadFromTree(
            Arrays.asList(new String[] {osName.toString(), osArch.toString()}).iterator());

    if (null == testContext) {
      throw new IllegalStateException(
          "No context for current operation system and architecture found: "
              + osName
              + ", "
              + osArch);
    }

    return testContext;
  }