use of org.testng.annotations.BeforeTest in project carbon-apimgt by wso2.
the class ConfigurationsAPITestCase method setup.
@BeforeTest
public void setup() throws Exception {
WorkflowExtensionsConfigBuilder.build(new ConfigProvider() {
@Override
public <T> T getConfigurationObject(Class<T> configClass) throws ConfigurationException {
T workflowConfig = (T) new WorkflowConfig();
return workflowConfig;
}
@Override
public Object getConfigurationObject(String s) throws ConfigurationException {
return null;
}
public <T> T getConfigurationObject(String s, Class<T> aClass) throws ConfigurationException {
return null;
}
});
ConfigProvider configProvider = Mockito.mock(ConfigProvider.class);
ServiceReferenceHolder.getInstance().setConfigProvider(configProvider);
}
use of org.testng.annotations.BeforeTest in project Payara by payara.
the class BaseAdminConsoleTest method loginBeforeTest.
/**
* This BeforeTest method will verify that the login form is available. Once
* it is found, the login form is submitted. If the login succeeds, then
* the tests are allowed to continue. If the login fails, the each test will
* fail.
* @param url
* @throws java.lang.Exception
*/
@BeforeTest
@Parameters({ "admin.console.url", "amx.rmiport" })
public void loginBeforeTest(String url, int port) throws Exception {
this.adminUrl = url;
setUpEnvironment(port);
client = new HttpClient();
boolean formFound = false;
int iteration = 0;
if (!checkForAdminConsoleDirectory()) {
Assert.fail("The admin console directory was not found at " + this.getDomainRoot().getInstallDir() + GLASSFISH_DIR + CONSOLE_DIR_PATH + ". Please check your installation.");
}
while (!formFound && iteration < AC_TEST_ITERATIONS) {
iteration++;
formFound = getUrlAndTestForStrings(adminUrl + "login.jsf", "id=\"Login.username\"");
if (!formFound) {
System.err.println("***** Login page not found. Sleeping to allow app to deploy (" + iteration + " of " + AC_TEST_ITERATIONS + ")...");
Thread.sleep(AC_TEST_DELAY);
}
}
if (!formFound) {
Assert.fail("The login form was not found.");
}
// The login for was found, so let's now POST the form to authenticate our session.
PostMethod post = new PostMethod(adminUrl + "j_security_check");
post.setRequestBody(new NameValuePair[] { new NameValuePair("j_username", "admin"), new NameValuePair("j_password", "") });
post.getParams().setCookiePolicy(CookiePolicy.RFC_2109);
int statusCode = client.executeMethod(post);
if (statusCode == 302) {
Header locationHeader = post.getResponseHeader("location");
if (locationHeader != null) {
Assert.assertTrue(locationHeader.getValue().startsWith(this.adminUrl));
} else {
Assert.fail("Failed to login: no redirect header");
}
} else if (statusCode != HttpStatus.SC_OK) {
Assert.fail("Login failed: " + post.getStatusLine() + ": " + statusCode);
}
}
use of org.testng.annotations.BeforeTest in project Payara by payara.
the class CDIEarTest method beforeTest.
@BeforeTest
public void beforeTest() throws NamingException {
context = new InitialContext();
String appJar = APP_JAR;
if (!SOURCE_HOME.startsWith("$")) {
appJar = SOURCE_HOME + SOURCE_HOME_APP;
}
deployed1 = NucleusTestUtils.nadmin("deploy", appJar);
Assert.assertTrue(deployed1);
}
use of org.testng.annotations.BeforeTest in project atsd-api-test by axibase.
the class SqlPeriodMonthTest method prepareData.
@BeforeTest
public void prepareData() throws Exception {
Series series = new Series(entity(), TEST_METRIC);
series.addSamples(Sample.ofDateInteger("2017-01-31T00:00:05Z", 1), Sample.ofDateInteger("2017-02-27T00:00:05Z", 2), Sample.ofDateInteger("2017-03-31T00:00:05Z", 3), Sample.ofDateInteger("2017-04-30T00:00:05Z", 4), Sample.ofDateInteger("2017-05-31T00:00:05Z", 5));
insertSeriesCheck(series);
}
use of org.testng.annotations.BeforeTest in project athenz by yahoo.
the class SimpleServiceIdentityProviderTest method loadKeys.
@BeforeTest
private void loadKeys() throws IOException {
Path path = Paths.get("./src/test/resources/fantasy_public_k0.key");
servicePublicKeyStringK0 = new String(Files.readAllBytes(path));
path = Paths.get("./src/test/resources/fantasy_private_k0.key");
k0File = path.toFile();
path = Paths.get("./src/test/resources/fantasy_public_k1.key");
servicePublicKeyStringK1 = new String(Files.readAllBytes(path));
path = Paths.get("./src/test/resources/fantasy_private_k1.key");
servicePrivateKeyStringK1 = new String(Files.readAllBytes(path));
}
Aggregations