@RunWith(Arquillian.class) @RunAsClient public abstract class AbstractClientArquillianTest {
@Test @RunAsClient public void testDeployDroolsFails() { try { deployer.deploy("deployment"); Assert.fail("exception expected"); }catch (Exception e) { // expected } }
@Test @RunAsClient public void testDeployProcessArchive() { try { deployer.deploy("deployment"); Assert.fail("exception expected"); }catch (Exception e) { // expected } }
@Test @RunAsClient public void testDeploymentFails(){ try { deployer.deploy(DEPLOYMENT_WITH_EJB_PA); Assert.fail("Deployment exception expected"); } catch(Exception e) { // expected } try { deployer.deploy(DEPLOYMENT_WITH_SERVLET_PA); Assert.fail("Deployment exception expected"); } catch(Exception e) { // expected } }
/** * This is an abstract test class for Arquillian driven client tests. * * @author Rick-Rainer Ludwig */ @RunWith(Arquillian.class) @RunAsClient public abstract class AbstractGlobalClientTest extends AbstractArquillianTest { }
@RunAsClient @Test(dataProvider = "formatProvider") public void testLicense(String type) { ValidatableResponse vr = callEndpoint(type); vr.body("info.license.name", equalTo("Apache 2.0")); vr.body("info.license.url", equalTo("http://www.apache.org/licenses/LICENSE-2.0.html")); }
@RunAsClient @Test(dataProvider = "formatProvider") public void testExternalDocumentation(String type) { ValidatableResponse vr = callEndpoint(type); vr.body("externalDocs.description", equalTo("instructions for how to deploy this app")); vr.body("externalDocs.url", containsString("README.md")); }
@RunAsClient @Test(dataProvider = "formatProvider") public void testExternalDocumentation(String type) { ValidatableResponse vr = callEndpoint(type); vr.body("externalDocs.description", equalTo("instructions for how to deploy this app")); vr.body("externalDocs.url", containsString("README.md")); }
@RunAsClient @Test(dataProvider = "formatProvider") public void testOperationAvailabilityResource(String type) { ValidatableResponse vr = callEndpoint(type); vr.body("paths.'/availability'.get.summary", equalTo("Retrieve all available flights")); vr.body("paths.'/availability'.get.operationId", equalTo("getFlights")); }
@RunAsClient @Test(dataProvider = "formatProvider") public void testVersion(String type) { ValidatableResponse vr = callEndpoint(type); vr.body("openapi", startsWith("3.0.")); }
@RunAsClient @Test(dataProvider = "formatProvider") public void testSecuritySchemes(String type) { ValidatableResponse vr = callEndpoint(type); String s = "components.securitySchemes"; vr.body(s, hasKey("httpTestScheme")); }
@RunAsClient @Test(dataProvider = "formatProvider") public void testVersion(String type) { ValidatableResponse vr = callEndpoint(type); vr.body("openapi", startsWith("3.0.")); }
@RunAsClient @Test(dataProvider = "formatProvider") public void testOAuthFlows(String type) { ValidatableResponse vr = callEndpoint(type); String t = "components.securitySchemes.petsOAuth2.flows"; vr.body(t, hasKey("implicit")); vr.body(t, hasKey("authorizationCode")); }
@Test @RunAsClient @InSequence(2) public void deployMain() { deployer.deploy( MAIN_DEPLOYMENT ); }
@Test @RunAsClient @InSequence(0) public void deployErrorChecking() { deployer.deploy( ERROR_CHECKING_DEPLOYMENT ); }
@Test @RunAsClient @InSequence(4) public void undeployMain() { // This will trigger application shut down, which should increment the destroy event counts deployer.undeploy( MAIN_DEPLOYMENT ); }
@Test @RunAsClient public void test() throws Exception { driver.get(applicationURL().toString()); System.out.println(driver.getPageSource()); WebDriverWait wait = new WebDriverWait(driver, 5); wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("/html[@bar]"))); WebElement elt = driver.findElement(By.tagName("html")); assertEquals("<bar>foo_value</bar>", elt.getAttribute("bar")); } }
@Test @RunAsClient public void test() throws Exception { driver.get(applicationURL().toString()); WebDriverWait wait = new WebDriverWait(driver, 5); wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("/html[@foo]"))); WebElement elt = driver.findElement(By.tagName("html")); assertEquals("foo_value", elt.getAttribute("foo")); } }
@Test @RunAsClient public final void testCopyAsset() throws Exception { CompilerAssert<File, File> compiler = getCompiler(); ReadWriteFileSystem<File> classOutput = compiler.getClassOutput(); File file = classOutput.getPath("plugin", "asset", "location", "defaultrelative", "assets", "test.js"); assertNotNull(file); assertTrue(file.exists()); assertTrue(file.isFile()); } }
@Test @RunAsClient @OperateOnDeployment("workbench") public void testEmbeddedEndpointsUsingRest(final @ArquillianResource URL baseURL) { client = KieServerControllerClientFactory.newRestClient(getRestURL(baseURL), USER, PASSWORD); testEmbeddedEndpoints(client); }