Skip to content

Commit

Permalink
Runtime detection of CDK added.
Browse files Browse the repository at this point in the history
FileUtils class created in common plugin.

Removed JBTSuite (was replaced by RedDeerSuite)
  • Loading branch information
rhopp authored and vpakan committed Dec 21, 2015
1 parent a6ed3ba commit 54231eb
Show file tree
Hide file tree
Showing 13 changed files with 117 additions and 33 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package org.jboss.tools.common.reddeer.utils;

import java.io.File;
import java.io.IOException;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;

public class FileUtils {

public static void deleteDirectory(File dir) throws IOException{
if (!dir.exists()){
return;
}
Files.walkFileTree(Paths.get(dir.getAbsolutePath()), new SimpleFileVisitor<Path>(){
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
Files.delete(file);
return FileVisitResult.CONTINUE;
}

@Override
public FileVisitResult postVisitDirectory(Path directory, IOException exc) throws IOException {
Files.delete(directory);
return FileVisitResult.CONTINUE;
}
});
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Require-Bundle: org.eclipse.ui,
org.jboss.reddeer.core;bundle-version="0.8.0",
org.jboss.reddeer.requirements;bundle-version="0.8.0",
org.jboss.reddeer.uiforms;bundle-version="0.8.0",
org.jboss.ide.eclipse.as.reddeer;bundle-version="[4.3.1,4.4.0)"
Import-Package: org.jboss.tools.runtime.reddeer.wizard
org.jboss.ide.eclipse.as.reddeer;bundle-version="[4.3.1,4.4.0)",
org.eclipse.jgit
Import-Package: org.jboss.tools.common.reddeer.utils,
org.jboss.tools.runtime.reddeer.wizard

5 changes: 5 additions & 0 deletions tests/org.jboss.tools.runtime.as.ui.bot.test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,11 @@
<artifactId>org.jboss.tools.seam.feature.feature.group</artifactId>
<version>0.0.0</version>
</dependency>
<dependency>
<type>p2-installable-unit</type>
<artifactId>org.eclipse.jgit.feature.group</artifactId>
<version>0.0.0</version>
</dependency>
</dependencies>
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ jboss-soa-p-standalone-5.3=${jboss-soa-p-standalone-5.3}
jboss-seam-2.3.x=${jboss-seam-2.3.x}
jboss-seam-2.2.2=${jboss-seam-2.2.2}
jboss-fsw-6.0=${jboss-fsw-6.0}
cdk-git=target/cdk-git
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package org.jboss.tools.runtime.as.ui.bot.test;

import org.jboss.reddeer.junit.runner.RedDeerSuite;
import org.jboss.tools.runtime.as.ui.bot.test.download.AllRuntimeDownload;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;

@RunWith(JBTSuite.class)
@RunWith(RedDeerSuite.class)
@Suite.SuiteClasses({
AllRuntimeDownload.class
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.jboss.tools.runtime.as.ui.bot.test;

import org.jboss.reddeer.junit.runner.RedDeerSuite;
import org.jboss.tools.runtime.as.ui.bot.test.detector.RuntimeDuplications;
import org.jboss.tools.runtime.as.ui.bot.test.detector.ServerWithSeam;
import org.jboss.tools.runtime.as.ui.bot.test.detector.seam.seam22.CheckSeam22;
Expand Down Expand Up @@ -70,7 +71,7 @@
import org.junit.runner.RunWith;
import org.junit.runners.Suite;

@RunWith(JBTSuite.class)
@RunWith(RedDeerSuite.class)
@Suite.SuiteClasses({
RuntimeDuplications.class,
ServerWithSeam.class,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.jboss.tools.runtime.as.ui.bot.test;

import org.jboss.reddeer.junit.runner.RedDeerSuite;
import org.jboss.tools.runtime.as.ui.bot.test.detector.RuntimeDuplications;
import org.jboss.tools.runtime.as.ui.bot.test.detector.ServerWithSeam;
import org.jboss.tools.runtime.as.ui.bot.test.detector.seam.seam22.CheckSeam22;
Expand Down Expand Up @@ -65,7 +66,7 @@
* @author Petr Suchy
* @author Radoslav Rabara
*/
@RunWith(JBTSuite.class)
@RunWith(RedDeerSuite.class)
@Suite.SuiteClasses({

RuntimeDuplications.class,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.jboss.tools.runtime.as.ui.bot.test;

import org.jboss.reddeer.junit.runner.RedDeerSuite;
import org.jboss.tools.runtime.as.ui.bot.test.detector.server.eap63.DetectEAP63;
import org.jboss.tools.runtime.as.ui.bot.test.detector.server.eap63.OperateEAP63;
import org.jboss.tools.runtime.as.ui.bot.test.detector.server.eap64.DetectEAP64;
Expand All @@ -26,7 +27,7 @@
*
* @author Radoslav Rabara
*/
@RunWith(JBTSuite.class)
@RunWith(RedDeerSuite.class)
@Suite.SuiteClasses({

DetectEAP70.class,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.jboss.tools.runtime.as.ui.bot.test;

import org.jboss.reddeer.junit.runner.RedDeerSuite;
import org.jboss.tools.runtime.as.ui.bot.test.detector.seam.seam22.CheckSeam22;
import org.jboss.tools.runtime.as.ui.bot.test.detector.seam.seam22.DetectSeam22;
import org.jboss.tools.runtime.as.ui.bot.test.detector.seam.seam23.CheckSeam23;
Expand All @@ -22,7 +23,7 @@
* @author Petr Suchy
* @author Radoslav Rabara
*/
@RunWith(JBTSuite.class)
@RunWith(RedDeerSuite.class)
@SuiteClasses({
ProjectRuntimeDownload.class,

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package org.jboss.tools.runtime.as.ui.bot.test;

import org.jboss.reddeer.junit.runner.RedDeerSuite;
import org.jboss.tools.runtime.as.ui.bot.test.detector.server.wildfly82.DetectWildFly82;
import org.jboss.tools.runtime.as.ui.bot.test.detector.server.wildfly82.OperateWildFly82;
import org.jboss.tools.runtime.as.ui.bot.test.download.SmokeRuntimeDownload;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;

@RunWith(JBTSuite.class)
@RunWith(RedDeerSuite.class)
@Suite.SuiteClasses({
SmokeRuntimeDownload.class,

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.jboss.tools.runtime.as.ui.bot.test;

import org.jboss.reddeer.junit.runner.RedDeerSuite;
import org.jboss.tools.runtime.as.ui.bot.test.detector.cdk2.DetectCDK2fromGit;
import org.jboss.tools.runtime.as.ui.bot.test.detector.seam.seam22.CheckSeam22;
import org.jboss.tools.runtime.as.ui.bot.test.detector.seam.seam22.DetectSeam22;
import org.jboss.tools.runtime.as.ui.bot.test.detector.seam.seam23x.CheckSeam23x;
Expand Down Expand Up @@ -34,11 +36,13 @@
*
* @author Radoslav Rabara
*/
@RunWith(JBTSuite.class)
@RunWith(RedDeerSuite.class)
@SuiteClasses({
ProjectRuntimeDownload.class,
ProductRuntimeDownload.class,

DetectCDK2fromGit.class,

DetectWildFly81.class,
OperateWildFly81.class,

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package org.jboss.tools.runtime.as.ui.bot.test.detector.cdk2;

import static org.junit.Assert.fail;

import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;

import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.jboss.tools.common.reddeer.utils.FileUtils;
import org.jboss.tools.runtime.as.ui.bot.test.RuntimeProperties;
import org.jboss.tools.runtime.as.ui.bot.test.entity.Runtime;
import org.jboss.tools.runtime.as.ui.bot.test.template.DetectRuntimeTemplate;
import org.junit.BeforeClass;

public class DetectCDK2fromGit extends DetectRuntimeTemplate {

private static final String SERVER_ID = "cdk-git";

private static final String GIT_REPOSITORY_URI = System.getProperty("jbt.cdk_git_uri");

@BeforeClass
public static void setup(){
File gitRepositoryDir = new File("target/cdk-git");
if (gitRepositoryDir.exists()){
try {
FileUtils.deleteDirectory(gitRepositoryDir);
} catch (IOException e) {
fail("Git repository already exists and its deletion was unsuccessfull");
}
}
gitRepositoryDir.mkdirs();
try {
Git.cloneRepository().setURI(GIT_REPOSITORY_URI).setDirectory(gitRepositoryDir).call();
} catch (GitAPIException e) {
fail("Unable to clone git repository");
}
}

@Override
protected String getPathID() {
return SERVER_ID;
}

@Override
protected List<Runtime> getExpectedRuntimes() {
Runtime expectedServer = new Runtime();
expectedServer.setName("cdk-v2");
expectedServer.setVersion("2.0");
expectedServer.setType("CDK");
expectedServer.setLocation(RuntimeProperties.getInstance().getRuntimePath(SERVER_ID));
return Arrays.asList(expectedServer);
}

}

0 comments on commit 54231eb

Please sign in to comment.