use of org.jboss.tools.openshift.reddeer.view.resources.OpenShiftResource in project jbosstools-openshift by jbosstools.
the class OSExplorerResourceTest method testDeploymentConfigVisibleAfterServiceDeletion.
/**
* Test if deployment config is visible in OS Explorer, when there is no service.
*/
@Test(expected = OpenshiftTestInFailureException.class)
public void testDeploymentConfigVisibleAfterServiceDeletion() {
this.project.expand();
Service service = this.project.getService(OpenShiftResources.EAP_SERVICE);
assertTrue("Service does not exist!", service != null);
service.select();
new ContextMenuItem("Delete").select();
new DefaultShell("Delete OpenShift Resource");
new OkButton().click();
// assert service is deleted
List<OpenShiftResource> resources = this.project.getOpenShiftResources(Resource.SERVICE);
assertTrue("Service not deleted!", resources.isEmpty());
try {
this.project.getTreeItem().getItem("eap-app selector: deploymentConfig=eap-app");
} catch (CoreLayerException e) {
// TODO: do not throw after JBIDE-24217 is fixed
throw new OpenshiftTestInFailureException("JBIDE-24217");
// TODO: uncomment after JBIDE-24217 is fixed
// fail("Deployment config not visible!");
}
}
use of org.jboss.tools.openshift.reddeer.view.resources.OpenShiftResource in project jbosstools-openshift by jbosstools.
the class TriggerBuildTest method testCreateNewBuildFromBuildConfig.
@Test
public void testCreateNewBuildFromBuildConfig() {
OpenShiftExplorerView explorer = new OpenShiftExplorerView();
explorer.reopen();
new WaitUntil(new OpenShiftResourceExists(Resource.BUILD_CONFIG, (Matcher<String>) null, ResourceState.UNSPECIFIED, projectReq.getProjectName(), connectionReq.getConnection()), TimePeriod.getCustom(120), true);
new WaitUntil(new OpenShiftResourceExists(Resource.BUILD, "eap-app-1", ResourceState.UNSPECIFIED, projectReq.getProjectName(), connectionReq.getConnection()), TimePeriod.LONG, true);
List<OpenShiftResource> builds = explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject(projectReq.getProjectName()).getOpenShiftResources(Resource.BUILD);
int oldAmountOfBuilds = builds.size();
explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject(projectReq.getProjectName()).getOpenShiftResources(Resource.BUILD_CONFIG).get(0).select();
new ContextMenuItem(OpenShiftLabel.ContextMenu.START_BUILD).select();
new WaitWhile(new JobIsRunning(), TimePeriod.LONG);
try {
new WaitUntil(new AmountOfResourcesExists(Resource.BUILD, oldAmountOfBuilds + 1, projectReq.getProjectName(), connectionReq.getConnection()), TimePeriod.LONG);
} catch (WaitTimeoutExpiredException ex) {
fail("New build was not triggered altough it should be.");
}
}
use of org.jboss.tools.openshift.reddeer.view.resources.OpenShiftResource in project jbosstools-openshift by jbosstools.
the class CreateApplicationFromTemplateTest method verifyCreatedApplication.
private void verifyCreatedApplication() {
OpenShiftExplorerView explorer = new OpenShiftExplorerView();
explorer.open();
OpenShiftProject project = explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject(DatastoreOS3.PROJECT1_DISPLAYED_NAME);
project.refresh();
new WaitWhile(new JobIsRunning(), TimePeriod.getCustom(120));
new WaitUntil(new OpenShiftResourceExists(Resource.BUILD_CONFIG, (Matcher<String>) null, ResourceState.UNSPECIFIED, DatastoreOS3.PROJECT1_DISPLAYED_NAME, connectionReq.getConnection()), TimePeriod.LONG, false);
List<OpenShiftResource> buildConfig = project.getOpenShiftResources(Resource.BUILD_CONFIG);
assertTrue("There should be precisely 1 build config for created application, but there is following amount" + " of build configs: " + buildConfig.size(), buildConfig.size() == 1);
assertTrue("There should be application name and git URI in build config tree item, but they are not." + "Application name is '" + applicationName + "' and git URI is '" + srcRepoURI + "', but build " + "config has name '" + buildConfig.get(0).getName() + "'", buildConfig.get(0).getPropertyValue("Labels", "application").equals(applicationName) && buildConfig.get(0).getPropertyValue("Source", "URI").equals(srcRepoURI));
List<OpenShiftResource> imageStream = project.getOpenShiftResources(Resource.IMAGE_STREAM);
assertTrue("There should be precisely 1 image stream for created application, but there is following amount" + " of image streams: " + imageStream.size(), imageStream.size() == 1);
List<OpenShiftResource> routes = project.getOpenShiftResources(Resource.ROUTE);
assertTrue("There should be precisely 1 route for created application, but there is following amount" + " of routes:" + routes.size(), routes.size() == 1);
assertTrue("Generated (default) route should contain application name, but it's not contained.", routes.get(0).getName().equals(applicationName));
List<OpenShiftResource> services = project.getOpenShiftResources(Resource.SERVICE);
assertTrue("There should be precisely 1 service for created application, but there is following amount" + " of services: " + services.size(), services.size() == 1);
}
use of org.jboss.tools.openshift.reddeer.view.resources.OpenShiftResource in project jbosstools-openshift by jbosstools.
the class OpenShiftResourceExists method test.
@Override
public boolean test() {
// workaround for disposed widget
if (project.getTreeItem().isDisposed()) {
this.project = explorer.getOpenShift3Connection(connection).getProject(project.getName());
}
this.project.refresh();
List<OpenShiftResource> resources = getResources();
for (OpenShiftResource rsrc : resources) {
if (resourceNameMatcher == null) {
return true;
}
if (resourceNameMatcher.matches(rsrc.getName())) {
if (!resourceState.equals(ResourceState.UNSPECIFIED)) {
return resourceState.toString().equals(rsrc.getStatus());
}
return true;
}
}
return false;
}
use of org.jboss.tools.openshift.reddeer.view.resources.OpenShiftResource 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