private static File getHomePath(TestContext context) { String home = context.getEnvironmentVariables().get(ENV_FRAMEWORK_HOME); if (home == null || home.trim().isEmpty()) { return null; } File file = new File(home); return file; }
private static File findFileOnHomePath(TestContext testContext, String path) { assert testContext != null; assert path != null; String home = testContext.getEnvironmentVariables().get(ENV_FRAMEWORK_HOME); if (home != null) { File file = new File(home, path); if (file.exists()) { return file; } } else { LOG.warn(MessageFormat.format( Messages.getString("WindGateTestHelper.warnUndefinedEnvironmentVariable"), //$NON-NLS-1$ ENV_FRAMEWORK_HOME)); } return null; }
/** * Creates a new instance. * @param callerClass the caller class (for detecting testing resources) * @param context the current testing context * @param tools the testing tools */ protected BatchTestTool(Class<?> callerClass, TestContext context, TestToolRepository tools) { this.classLoader = context.getClassLoader(); this.batchArguments = new LinkedHashMap<>(context.getArguments()); this.environmentVariables = new LinkedHashMap<>(context.getEnvironmentVariables()); this.callerClass = callerClass; this.tools = new TestToolRepository(classLoader); }
/** * Creates a WindGate {@link ProfileContext} for the test context. * @param testContext the current test context * @return the created {@link ProfileContext} * @since 0.7.2 */ public static ProfileContext createProfileContext(TestContext testContext) { if (testContext == null) { throw new IllegalArgumentException("testContext must not be null"); //$NON-NLS-1$ } Holder.clean(); ClassLoader loader = findClassLoader(testContext); return new ProfileContext(loader, new ParameterList(testContext.getEnvironmentVariables())); }