Skip to content

Commit

Permalink
JBIDE-23823 Move forge.reddeer plugin to jbosstools-forge (#176)
Browse files Browse the repository at this point in the history
Signed-off-by: Josef Kopriva <jkopriva@redhat.com>
  • Loading branch information
jkopriva authored and jeffmaury committed Nov 13, 2017
1 parent 1b77eb0 commit a281a8f
Show file tree
Hide file tree
Showing 15 changed files with 703 additions and 0 deletions.
6 changes: 6 additions & 0 deletions features/org.jboss.tools.forge.test.feature/feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,11 @@
install-size="0"
version="0.0.0"
fragment="true"/>

<plugin
id="org.jboss.tools.forge.reddeer"
download-size="0"
install-size="0"
version="0.0.0"/>

</feature>
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<module>tests</module>
<module>features</module>
<module>site</module>
<module>test-framework</module>
</modules>
<repositories>
<!-- To resolve parent artifact -->
Expand Down
6 changes: 6 additions & 0 deletions test-framework/org.jboss.tools.forge.reddeer/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
screenshots/
target/
bin/
/.classpath
/.project
.settings/
16 changes: 16 additions & 0 deletions test-framework/org.jboss.tools.forge.reddeer/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Forge RedDeer
Bundle-SymbolicName: org.jboss.tools.forge.reddeer
Bundle-Version: 2.0.201.qualifier
Bundle-Activator: org.jboss.tools.forge.reddeer.Activator
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.reddeer.go;bundle-version="2.0.0",
org.eclipse.ui,
org.junit;bundle-version="4.11.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Export-Package: org.jboss.tools.forge.reddeer,
org.jboss.tools.forge.reddeer.condition,
org.jboss.tools.forge.reddeer.view,
org.jboss.tools.forge.reddeer.ui.wizard
4 changes: 4 additions & 0 deletions test-framework/org.jboss.tools.forge.reddeer/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.
14 changes: 14 additions & 0 deletions test-framework/org.jboss.tools.forge.reddeer/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jboss.tools.forge</groupId>
<artifactId>test-framework</artifactId>
<version>2.0.201-SNAPSHOT</version>
</parent>
<groupId>org.jboss.tools.forge</groupId>
<artifactId>org.jboss.tools.forge.reddeer</artifactId>
<packaging>eclipse-plugin</packaging>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*******************************************************************************
* Copyright (c) 2017 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.forge.reddeer;

import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;

/**
* The activator class controls the plug-in life cycle
*/
public class Activator extends AbstractUIPlugin {

// The plug-in ID
public static final String PLUGIN_ID = "org.jboss.tools.forge.reddeer"; //$NON-NLS-1$

// The shared instance
private static Activator plugin;

/**
* The constructor
*/
public Activator() {
}

/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}

/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}

/**
* Returns the shared instance
*
* @return the shared instance
*/
public static Activator getDefault() {
return plugin;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*******************************************************************************
* Copyright (c) 2017 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.forge.reddeer.condition;

import org.eclipse.reddeer.common.condition.AbstractWaitCondition;
import org.jboss.tools.forge.reddeer.view.ForgeConsoleView;

/**
* Returns true if a console has no change for the specified time period.
*
* @author jkopriva@redhat.com
*
*/
public class ForgeConsoleHasNoChange extends AbstractWaitCondition {

private String consoleText;

/**
* Constructs the condition.
*
*/
public ForgeConsoleHasNoChange() {
this.consoleText = getConsoleText();
}

/*
* (non-Javadoc)
*
* @see org.eclipse.reddeer.common.condition.WaitCondition#test()
*/
@Override
public boolean test() {
String currentConsoleText = getConsoleText();

if (!currentConsoleText.equals(consoleText)) {
consoleText = currentConsoleText;
return false;
}
return true;
}

/*
* (non-Javadoc)
*
* @see
* org.eclipse.reddeer.common.condition.AbstractWaitCondition#description()
*/
@Override
public String description() {
return "Forge console is still changing";
}

/**
* Returns Forge Console text.
*
* @return String
* Console Text
*/
private static String getConsoleText() {
ForgeConsoleView forgeConsoleView = new ForgeConsoleView();
forgeConsoleView.open();
return forgeConsoleView.getConsoleText();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*******************************************************************************
* Copyright (c) 2017 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.forge.reddeer.condition;

import org.eclipse.reddeer.common.condition.AbstractWaitCondition;
import org.jboss.tools.forge.reddeer.view.ForgeConsoleView;

/**
* Returns true if the console contains a given text
*
* @author psrna
*
*/
public class ForgeConsoleHasText extends AbstractWaitCondition {

private String text;

/**
* Construct the condition with a given text.
*
* @param text Text
*/
public ForgeConsoleHasText(String text) {
this.text = text;
}

@Override
public boolean test() {
String consoleText = getConsoleText();
return consoleText.contains(text);
}

@Override
public String description() {
String consoleText = getConsoleText();
return "console contains '" + text + "'\n" + consoleText;
}

private static String getConsoleText() {
ForgeConsoleView forgeConsoleView = new ForgeConsoleView();
forgeConsoleView.open();
return forgeConsoleView.getConsoleText();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*******************************************************************************
* Copyright (c) 2017 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.forge.reddeer.condition;

import org.eclipse.reddeer.common.condition.AbstractWaitCondition;
import org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer;

/**
* Returns true if a project is selected in Project Explorer.
*
* @author jkopriva@redhat.com
*
*/
public class ProjectIsSelected extends AbstractWaitCondition {

private String projectName;
private ProjectExplorer pe;

/**
* Construct the condition.
*
* @param projectName Name of project, which should be selected in Project Explorer.
*/
public ProjectIsSelected(String projectName) {
this.projectName = projectName;
this.pe = new ProjectExplorer();
pe.open();
}


/*
* (non-Javadoc)
*
* @see org.eclipse.reddeer.common.condition.WaitCondition#test()
*/
@Override
public boolean test() {
if (!pe.getProject(this.projectName).isSelected()) {
return false;
}
return true;
}

/*
* (non-Javadoc)
*
* @see
* org.eclipse.reddeer.common.condition.AbstractWaitCondition#description()
*/
@Override
public String description() {
return "Project has not been selected in Project Explorer!";
}

}
Loading

0 comments on commit a281a8f

Please sign in to comment.