@Nonnull private URL buildBaseUrl(@Nonnull final ProductInstance productInstance) { try { return new URL(productInstance.getBaseUrl()); } catch (MalformedURLException e) { throw new RuntimeException("Could not create product instance's base url", e); } }
public ProductInstanceBasedEnvironmentData(@Nonnull final ProductInstance productInstance) { super(new Properties()); notNull(productInstance); baseUrl = buildBaseUrl(productInstance); contextPath = productInstance.getContextPath(); xmlDataLocation = new File("./xml"); }
@Override protected boolean checkInstalled() { return checkInstalledViaGet(jiraProduct.getBaseUrl() + "/rest/testkit-test/1.0/dataImport/importConfig"); } }
public FieldPicker switchToCustomMode() { if (getMode() != Mode.CUSTOM) { Tracer tracer = traceContext.checkpoint(); customModeLink.click(); Pattern xhrPattern = Pattern.compile(jiraProduct.getContextPath() + "/secure/((QuickCreateIssue!default.jspa\\?decorator=none)|(QuickEditIssue!default.jspa\\?issueId=([0-9]+)&decorator=none))"); traceContext.waitFor(tracer, "AJS.$.ajaxComplete", xhrPattern); } return binder.bind(FieldPicker.class); }
@Override protected boolean checkInstalled() { return checkInstalledViaGet(jiraProduct.getBaseUrl() + "/rest/func-test/1.0/slomo/default"); } }
public static void repairEntityLinks(final JiraTestedProduct jira, final String projectKey) throws JSONException { repairEntityLinks(jira, projectKey, jira.environmentData().getContext(), JiraProjectEntityType.class); repairEntityLinks(jira, projectKey, ForeignTestedProductFactory.newConfluenceTestedProduct().getProductInstance().getContextPath(), ConfluenceSpaceEntityType.class); repairEntityLinks(jira, projectKey, ForeignTestedProductFactory.newBambooTestedProduct().getProductInstance().getContextPath(), BambooProjectEntityType.class); }
/** * Create a ConnectRunner for an add-on with a specified key * @param testedProduct the product to install the add-on into * @param key the key for the add-on */ public ConnectRunner(TestedProduct testedProduct, String key) { this(testedProduct.getProductInstance().getBaseUrl(), key); }
/** * Create a ConnectRunner for an add-on with a specified key * @param testedProduct the product to install the add-on into * @param key the key for the add-on */ public ConnectRunner(TestedProduct testedProduct, String key) { this(testedProduct.getProductInstance().getBaseUrl(), key); }
private Config loadConfig() { final String uri = jiraProduct.getBaseUrl() + "/rest/testkit-test/1.0/config-info"; logger.debug("Request to " + uri); final HttpGet get = new HttpGet(uri); HttpResponse response = null; try { response = client.execute(get); final String responseString = EntityUtils.toString(response.getEntity()); return parseResponse(responseString); } catch (IOException e) { throw new RuntimeException(e); } finally { closeQuietly(response); } }
/** * get the login link from the anonymous warning message box */ public Option<URI> getAnonymousWarningLoginLink() { return anonymousWarningMessageBox.get().map(input -> URI.create(product.getProductInstance().getBaseUrl() + input.findElement(By.tagName("a")).getAttribute("href"))); } }
public ConfluenceTestUserFactory(ConfluenceTestedProduct product) { this(product, ConfluenceRpc.newInstance(product.getProductInstance().getBaseUrl())); }
public void logOutFast() { webDriverTester.gotoUrl(getProductInstance().getBaseUrl() + "/plugins/functest/logout.action"); }
/** * Faster way of login when in testing environment by embedding the credentials in the url, * so we don't have to visit the login page every single time. */ public <M extends Page> M autoLoginEmbeddingCredentialsInUrl(UserWithDetails user, Class<M> destinationClass, Object... args) { checkNotNull(destinationClass); DelayedBinder<M> binder = pageBinder.delayedBind(destinationClass, args); M p = binder.get(); checkNotNull(p); URI uriBuilder = UriBuilder.fromUri(productInstance.getBaseUrl() + p.getUrl()) .queryParam("os_username", user.getUsername()) .queryParam("os_password", user.getPassword()) .build(); webDriverTester.gotoUrl(uriBuilder.toString()); return binder.bind(); }
private LifecycleTestUtils(TestedProduct<WebDriverTester> product) { String baseUrl = product.getProductInstance().getBaseUrl(); this.product = product; this.addonControlClient = new AddonControlClient(baseUrl, "admin", "admin"); this.connectClient = new AtlassianConnectRestClient(baseUrl, "admin", "admin"); }
public <P extends Page> DelayedBinder<P> visitDelayed(final Class<P> pageClass, final Object... args) { final DelayedBinder<P> binder = pageBinder.delayedBind(pageClass, args); webDriverTester.gotoUrl(productInstance.getBaseUrl() + binder.get().getUrl()); return binder; }
public HelpTipApiClient(TestedProduct product, TestUser user) { this.baseUrl = product.getProductInstance().getBaseUrl(); this.defaultUsername = user.getUsername(); this.defaultPassword = user.getPassword(); this.userRequestSender = new UserRequestSender(baseUrl); }
public HelpTipApiClient(TestedProduct product, TestUser user) { this.baseUrl = product.getProductInstance().getBaseUrl(); this.defaultUsername = user.getUsername(); this.defaultPassword = user.getPassword(); this.userRequestSender = new UserRequestSender(baseUrl); }
private static boolean isAt(EchoPage page, TestedProduct<WebDriverTester> product) { return product.getTester().getDriver().getCurrentUrl().startsWith(product.getProductInstance().getBaseUrl()) && page.isAt().now(); } }
public AcceptanceTestHelper(TestUser user, String descriptorUrl, TestedProduct product) { this.user = user; this.descriptorUrl = descriptorUrl; addonDescriptorParser = new AddonDescriptorParser(descriptorUrl); connectRestClient = new AtlassianConnectRestClient( product.getProductInstance().getBaseUrl(), user.getUsername(), user.getPassword()); }
public static void updateOndemandLicense(final JiraTestedProduct jira, final String license) throws Exception { final String baseUrl = jira.getProductInstance().getBaseUrl(); final DefaultHttpClient<Void> httpClient = createDefaultHttpClient(baseUrl); final long debugExecutionStart = System.currentTimeMillis(); try { final Header authenticateHeader = BasicScheme.authenticate(Users.getDefaultSysAdminCredentials(), "UTF-8", false); final Request request = httpClient.newRequest(baseUrl + "/rest/ondemand/license/latest/license"); request.setEntity(license).setContentType("text/plain") .setHeader(authenticateHeader.getName(), authenticateHeader.getValue()); final Response r = request.put().get(); if (r.getStatusCode() != Status.OK.getStatusCode()) { throw new IllegalStateException("Error updating OD license " + request.getUri() + ", status code =" + r.getStatusCode() + ": " + r.getEntity()); } } finally { httpClient.destroy(); final long debugExecutionEnd = System.currentTimeMillis(); System.out.println(String.format( "DEBUG com.atlassian.jira.utils.OndemandEnvironmentTestUtils.updateOndemandLicense execution took %.3f s", (debugExecutionEnd - debugExecutionStart) / 1000.0 )); } }