@PostConstruct()
	public void initalizeEc2Environment() throws MalformedURLException {
		if (isOnEc2()) {
			artifactProperties = ConfigUtil.getPropertiesFromArtifact();
			adminServerUrl = new URL(artifactProperties.getProperty(XD_ADMIN_HOST));
			jmxPort = Integer.parseInt(artifactProperties.getProperty(XD_JMX_PORT));
			httpPort = Integer.parseInt(artifactProperties.getProperty(XD_HTTP_PORT));
		}
		else {
			adminServerUrl = new URL(adminHost);
		}

		if (jdbcUrl == null) {
			return;
		}
		dataSource = new SimpleDriverDataSource();
		rabbitConnectionFactory = new CachingConnectionFactory(adminServerUrl.getHost());
		try {
			@SuppressWarnings("unchecked") Class<? extends Driver> classz =
					(Class<? extends Driver>) ClassUtils.forName(jdbcDriver, beanClassLoader);
			dataSource.setDriverClass(classz);
		}
		catch (ClassNotFoundException e) {
			throw new IllegalStateException("failed to load class: " + jdbcDriver, e);
		}
		String resolvedJdbcUrl = String.format(jdbcUrl, jdbcDatabase);
		dataSource.setUrl(resolvedJdbcUrl);
		if (jdbcUsername != null) {
			dataSource.setUsername(jdbcUsername);
		}
		if (jdbcPassword != null) {
			dataSource.setPassword(jdbcPassword);
		}

		try {
			mongoDbFactory = new SimpleMongoDbFactory(new MongoClient(mongoHost + ":" + mongoPort), "xd");
		}
		catch (UnknownHostException unknownHostException) {
			throw new IllegalStateException(unknownHostException.getMessage(), unknownHostException);
		}

	}
If not running tests on a local XD Instance it will retrieve the information from the artifact and setup the
environment to test against a remote XD. Als initializes the dataSource for JDBC Tests.

@throws MalformedURLException
spring-xd-integration-test/src/main/java/org/springframework/xd/integration/util/XdEnvironment.java