use of org.jboss.tools.openshift.reddeer.view.resources.OpenShiftResource in project jbosstools-openshift by jbosstools.
the class TriggerBuildTest method testCloneExistingBuild.
@Test
public void testCloneExistingBuild() {
OpenShiftExplorerView explorer = new OpenShiftExplorerView();
explorer.reopen();
new WaitUntil(new OpenShiftResourceExists(Resource.BUILD, (Matcher<String>) null, ResourceState.UNSPECIFIED, projectReq.getProjectName(), connectionReq.getConnection()), TimePeriod.getCustom(240), true);
List<OpenShiftResource> builds = explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject(projectReq.getProjectName()).getOpenShiftResources(Resource.BUILD);
builds.get(0).select();
new ContextMenuItem(OpenShiftLabel.ContextMenu.CLONE_BUILD).select();
int oldAmountOfBuilds = builds.size();
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 ScalingTest method testScaleApplicationViaContextMenuOfReplicationController.
@Test
public void testScaleApplicationViaContextMenuOfReplicationController() {
OpenShiftResource replicationController = project.getOpenShiftResource(Resource.DEPLOYMENT, OpenShiftResources.NODEJS_APP_REPLICATION_CONTROLLER);
assertNotNull(replicationController);
// ensure we scale
int pods = PodsAreDeployed.getNumberOfCurrentReplicas(project, replicationController.getName());
if (pods == 1) {
pods = 2;
} else {
pods = 1;
}
replicationController.select();
scaleTo(pods);
assertPodAmountDesiredEqualsCurrent(pods, project);
replicationController.select();
scaleUp();
assertPodAmountDesiredEqualsCurrent(++pods, project);
replicationController.select();
scaleDown();
assertPodAmountDesiredEqualsCurrent(--pods, project);
}
use of org.jboss.tools.openshift.reddeer.view.resources.OpenShiftResource in project jbosstools-openshift by jbosstools.
the class HandleCustomTemplateTest method createTemplateFromJson.
private void createTemplateFromJson() {
OpenShiftExplorerView explorer = new OpenShiftExplorerView();
explorer.open();
explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject().select();
new ContextMenuItem(OpenShiftLabel.ContextMenu.NEW_RESOURCE).select();
new DefaultShell(OpenShiftLabel.Shell.NEW_RESOURCE);
new LabeledText(OpenShiftLabel.TextLabels.RESOURCE_LOCATION).setText(System.getProperty("user.dir") + File.separator + "resources" + File.separator + "hello-world-template.json");
new FinishButton().click();
new DefaultShell(OpenShiftLabel.Shell.CREATE_RESOURCE_SUMMARY);
assertTrue("Template is not listed in created resources summary", new DefaultTree().getAllItems().size() == 1);
new OkButton().click();
new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.NEW_RESOURCE));
new WaitWhile(new JobIsRunning(), TimePeriod.LONG);
List<OpenShiftResource> templates = explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject().getOpenShiftResources(Resource.TEMPLATE);
assertTrue("There should be precisely 1 created template for the project.", templates.size() > 0);
String templateName = templates.get(0).getName();
assertTrue("Template name '" + templateName + "' does not match required name " + "helloworld-sample.", templateName.equals("helloworld-sample"));
}
use of org.jboss.tools.openshift.reddeer.view.resources.OpenShiftResource in project jbosstools-openshift by jbosstools.
the class LogsTest method shouldShowLogFromApplicationPodContextMenu.
@Test
public void shouldShowLogFromApplicationPodContextMenu() {
new WaitUntil(new OpenShiftResourceExists(Resource.POD, new StringStartsWith("eap-app-"), ResourceState.RUNNING, requiredProject.getProjectName(), requiredConnection.getConnection()), TimePeriod.VERY_LONG);
this.consoleView = new ConsoleView();
this.consoleView.open();
OpenShiftResource pod = OpenShiftUtils.getOpenShiftPod(requiredProject.getProjectName(), new StringStartsWith("eap-app-"), requiredConnection.getConnection());
String podName = pod.getName();
pod.select();
new ContextMenuItem(OpenShiftLabel.ContextMenu.POD_LOG).select();
new WaitUntil(new ConsoleHasText(), TimePeriod.DEFAULT);
new WaitUntil(new ConsoleHasNoChange(TimePeriod.getCustom(WAIT_CONSOLE_NO_CHANGE)), TimePeriod.VERY_LONG);
assertTrue("Console label is incorrect, it should contains project name and pod name.\n" + "but label is: " + consoleView.getConsoleLabel(), consoleView.getConsoleLabel().contains(requiredProject.getProjectName() + "\\" + podName));
assertTrue("Console text should contain output from EAP runtime", consoleView.getConsoleText().contains("Admin console is not enabled"));
}
use of org.jboss.tools.openshift.reddeer.view.resources.OpenShiftResource in project jbosstools-openshift by jbosstools.
the class LogsTest method shouldShowLogFromBuildPodContextMenu.
@Test
public void shouldShowLogFromBuildPodContextMenu() {
new WaitUntil(new OpenShiftResourceExists(Resource.BUILD, new StringStartsWith("eap-app-"), ResourceState.RUNNING, requiredProject.getProjectName(), requiredConnection.getConnection()), TimePeriod.VERY_LONG);
this.consoleView = new ConsoleView();
this.consoleView.open();
OpenShiftResource pod = OpenShiftUtils.getOpenShiftPod(requiredProject.getProjectName(), Resource.BUILD, new StringStartsWith("eap-app-"), requiredConnection.getConnection());
String podName = pod.getName();
pod.select();
new ContextMenuItem(OpenShiftLabel.ContextMenu.BUILD_LOG).select();
new WaitUntil(new ConsoleHasText(), TimePeriod.LONG);
new WaitUntil(new ConsoleHasNoChange(TimePeriod.getCustom(WAIT_CONSOLE_NO_CHANGE)), TimePeriod.VERY_LONG);
assertTrue("Console label is incorrect, it should contain project name and name of build pod.\n" + "but label is: " + consoleView.getConsoleLabel(), consoleView.getConsoleLabel().contains(requiredProject.getProjectName() + "\\" + podName));
try {
new WaitUntil(new ConsoleHasText("Push successful"), TimePeriod.getCustom(WAIT_CONSOLE_PUSH_SUCCESS));
} catch (WaitTimeoutExpiredException ex) {
fail("There should be output of succesful build in console log, but there is not.\n" + "Check whether output has not changed. Assumed output in the end of log is 'Push successful'");
}
}
Aggregations