-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FileUtils class created in common plugin. Removed JBTSuite (was replaced by RedDeerSuite)
- Loading branch information
Showing
13 changed files
with
117 additions
and
33 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
...ns/org.jboss.tools.common.reddeer/src/org/jboss/tools/common/reddeer/utils/FileUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
}); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...s.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/AllRuntimeDownloadTestSuite.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 0 additions & 24 deletions
24
...oss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/JBTSuite.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...s.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/SmokeSuite.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
....bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/detector/cdk2/DetectCDK2fromGit.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
|
||
} |