@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); } }
@Override protected boolean checkInstalled() { return checkInstalledViaGet(jiraProduct.getBaseUrl() + "/rest/testkit-test/1.0/dataImport/importConfig"); } }
/** * 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); }
@Override protected boolean checkInstalled() { return checkInstalledViaGet(jiraProduct.getBaseUrl() + "/rest/func-test/1.0/slomo/default"); } }
/** * 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 void logOutFast() { webDriverTester.gotoUrl(getProductInstance().getBaseUrl() + "/plugins/functest/logout.action"); }
public ConfluenceTestUserFactory(ConfluenceTestedProduct product) { this(product, ConfluenceRpc.newInstance(product.getProductInstance().getBaseUrl())); }
/** * 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 )); } }
public JiraTestedProduct(final TestedProductFactory.TesterFactory<WebDriverTester> testerFactory, final ProductInstance productInstance) { checkNotNull(productInstance); this.webDriverTester = testerFactory == null ? new DefaultWebDriverTester() : testerFactory.create(); this.productInstance = productInstance; final BaseUrlSupplierForHost baseUrlSupplier = new BaseUrlSupplierForHost(productInstance.getBaseUrl(), () -> Optional.ofNullable(host)); this.pageBinder = new InjectPageBinder(baseUrlSupplier, webDriverTester, new StandardModule(this), new AtlassianWebDriverModule(this), new ElementModule(), new TimeoutsModule(), binder -> binder.bind(PostInjectionProcessor.class).to(ClickableLinkPostInjectionProcessor.class)); this.pageBinder.override(Header.class, JiraHeader.class); this.pageBinder.override(HomePage.class, DashboardPage.class); this.pageBinder.override(AdminHomePage.class, JiraAdminHomePage.class); this.pageBinder.override(LoginPage.class, JiraLoginPage.class); this.pageBinder.override(WebSudoPage.class, JiraWebSudoPage.class); }
public ConfluenceTestedProduct(TestedProductFactory.TesterFactory<WebDriverTester> testerFactory, ProductInstance productInstance) { checkNotNull(productInstance); this.webDriverTester = testerFactory == null ? new DefaultWebDriverTester() : testerFactory.create(); this.productInstance = productInstance; final BaseUrlSupplierForHost baseUrlSupplier = new BaseUrlSupplierForHost(productInstance.getBaseUrl(), () -> Optional.ofNullable(host)); this.pageBinder = new InjectPageBinder(baseUrlSupplier, webDriverTester, new StandardModule(this), new AtlassianWebDriverModule(this), new ElementModule(), new TimeoutsModule()); this.pageBinder.override(Header.class, ConfluenceHeader.class); this.pageBinder.override(HomePage.class, DashboardPage.class); this.pageBinder.override(LoginPage.class, ConfluenceLoginPage.class); this.pageBinder.override(AdminHomePage.class, ConfluenceAdminHomePage.class); this.pageBinder.override(WebSudoPage.class, ConfluenceWebSudoPage.class); this.pageBinder.override(WebSudoBanner.class, ConfluenceWebSudoBanner.class); }
@Override protected void configureInjection(final InjectionConfiguration injectionConfiguration) { final Client client = ConfluenceJacksonClientBuilder.newClient(); final BaseUrlSelector urlSelector = new ConfluenceInjectedBaseUrlSelector(getProduct().getProductInstance().getBaseUrl()); final ConfluenceRestClient restClient = new ConfluenceRestClient(urlSelector, client); final ConfluenceRpcClient rpcClient = new ConfluenceRpcClient(urlSelector, VersionedRpcBaseResolver.V2); final DirectoryConfiguration directoryConfiguration = new DirectoryConfigurationFactory(rpcClient, restClient).getInstance(TestProperties.getTestProperty("ldapMode")); final UserManager userManager = directoryConfiguration.getHelper(); final TestUserFactory testUserFactory = new TestUserFactory(userManager); final AuthenticatedWebResourceProvider authProvider = new AuthenticatedWebResourceProvider(client, urlSelector.getBaseUrl(), ""); injectRestClientServices(injectionConfiguration, authProvider); injectionConfiguration .addSingleton(UserManager.class, userManager) .addSingleton(TestUserFactory.class, testUserFactory) .addSingleton(ConfluenceRestClient.class, restClient) .addSingleton(ConfluenceRpcClient.class, rpcClient) .addSingleton(BaseUrlSelector.class, urlSelector) .addSingleton(AuthenticatedWebResourceProvider.class, authProvider) .addSingleton(Client.class, client) .addSingleton(RemoteConfluenceVersion.class, new RemoteConfluenceVersion(restClient)) .addSingleton(UpmVersion.class, new UpmVersion(restClient)); }