use of org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists in project jbosstools-openshift by jbosstools.
the class ServerAdapterFromResourceTest method importProject.
@BeforeClass
public static void importProject() {
explorer = new OpenShiftExplorerView();
explorer.open();
project = explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject(DatastoreOS3.TEST_PROJECT);
project.getServicesWithName(OpenShiftResources.NODEJS_SERVICE).get(0).select();
new ContextMenuItem(OpenShiftLabel.ContextMenu.IMPORT_APPLICATION).select();
new WaitUntil(new ShellIsAvailable(OpenShiftLabel.Shell.IMPORT_APPLICATION));
ImportApplicationWizard appWizard = new ImportApplicationWizard();
try {
CheckBox checkBox = new CheckBox("Do not clone - use existing repository");
if (checkBox.isEnabled()) {
checkBox.toggle(true);
LOGGER.debug("Using existing project, skipping import");
}
} catch (RedDeerException ex) {
LOGGER.debug("No existing project found, importing");
}
try {
appWizard.finish();
} catch (WaitTimeoutExpiredException ex) {
// When running test in suite, it needs to be selected correct build config(in OpenShift instance could be more build configs)
appWizard.selectExistingBuildConfiguration(OpenShiftResources.NODEJS_APP_DEPLOYMENT_CONFIG);
appWizard.finish();
}
new WaitUntil(new OpenShiftResourceExists(Resource.DEPLOYMENT, OpenShiftResources.NODEJS_APP_REPLICATION_CONTROLLER, ResourceState.UNSPECIFIED, DatastoreOS3.TEST_PROJECT, connectionReq.getConnection()), TimePeriod.LONG);
}
use of org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists in project jbosstools-openshift by jbosstools.
the class CreateResourcesTest method testCreateResourceFromLocalFile.
@Test
public void testCreateResourceFromLocalFile() {
createResource(RESOURCES_LOCATION + File.separator + "hello-pod.json");
refreshProject();
assertTrue("Hello pod has not been created from file", explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject(testProject).getOpenShiftResource(Resource.POD, POD_NAME) != null);
new WaitUntil(new OpenShiftResourceExists(Resource.POD, POD_NAME, ResourceState.RUNNING, testProject, connectionReq.getConnection()), TimePeriod.LONG);
createResource(RESOURCES_LOCATION + File.separator + "hello-service.json");
refreshProject();
assertTrue("Hello service has not been created from file", explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject(testProject).getOpenShiftResource(Resource.SERVICE, SERVICE_NAME) != null);
assertTrue("Hello service is not visible in OpenShift Explorer view", explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject(testProject).getService(SERVICE_NAME).getTreeItem() != null);
createResource(RESOURCES_LOCATION + File.separator + "hello-route.json");
refreshProject();
assertTrue("Hello route has not been created from file", explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject(testProject).getOpenShiftResource(Resource.ROUTE, ROUTE_NAME) != null);
}
use of org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists in project jbosstools-openshift by jbosstools.
the class CreateResourcesTest method testCreateResourceFromURL.
@Test
public void testCreateResourceFromURL() {
createResource("https://raw.githubusercontent.com/jbosstools/jbosstools-openshift/master/itests/org.jboss.tools.openshift.ui.bot.test/resources/hello-pod.json");
new WaitUntil(new OpenShiftResourceExists(Resource.POD, POD_NAME, ResourceState.RUNNING, testProject, connectionReq.getConnection()), TimePeriod.LONG);
assertTrue("Hello pod has not been created from file", explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject(testProject).getOpenShiftResource(Resource.POD, POD_NAME) != null);
}
use of org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists in project jbosstools-openshift by jbosstools.
the class DeleteResourceTest method waitForApplication.
@BeforeClass
public static void waitForApplication() {
new WaitUntil(new OpenShiftResourceExists(Resource.BUILD, "eap-app-1", ResourceState.COMPLETE, projectReq.getProjectName(), connectionReq.getConnection()), TimePeriod.getCustom(600), true);
new WaitUntil(new AmountOfResourcesExists(Resource.POD, 2, projectReq.getProjectName(), connectionReq.getConnection()), TimePeriod.VERY_LONG, true);
}
use of org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists in project jbosstools-openshift by jbosstools.
the class DeleteResourceTest method deleteResourceAndAssert.
private void deleteResourceAndAssert(Resource resource) {
OpenShiftExplorerView explorer = new OpenShiftExplorerView();
OpenShiftResource rsrc = explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject(projectReq.getProjectName()).getOpenShiftResources(resource).get(0);
String resourceName = rsrc.getName();
rsrc.delete();
try {
OpenShiftResourceExists openShiftResourceExists = new OpenShiftResourceExists(resource, resourceName, ResourceState.UNSPECIFIED, projectReq.getProjectName(), connectionReq.getConnection());
new WaitWhile(openShiftResourceExists, TimePeriod.getCustom(15));
} catch (WaitTimeoutExpiredException ex) {
fail("Route " + resource + " should be deleted at this point but it is still present.");
}
}
Aggregations