Skip to content

Commit

Permalink
Update the paths of jar and class
Browse files Browse the repository at this point in the history
  • Loading branch information
ailiujiarui committed Oct 31, 2024
1 parent b1f2250 commit 81b47d9
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public class WorkflowJavaTaskE2ETest {

private static final String environmentWorkerGroup = "default";

private static final String filePath = "/tmp";
private static final String filePath = "/tmp/dolphinscheduler/runner/resources/";

private static RemoteWebDriver browser;

Expand Down Expand Up @@ -146,9 +146,9 @@ public static void cleanup() {
}
private static void createJar(String classFile, String entryName, String mainPackage, String jarName) {

String classFilePath = "/tmp/common/" + classFile;
String classFilePath = "/tmp/dolphinscheduler/runner/resources/" + classFile;

String jarFilePath = "/tmp/" + jarName;
String jarFilePath = "/tmp/dolphinscheduler/runner/resources/" + jarName;

Manifest manifest = new Manifest();
manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
Expand All @@ -171,23 +171,17 @@ private static void createJar(String classFile, String entryName, String mainPac

private static void getJar() {
compileJavaFlow();
await().atMost(Duration.ofMinutes(5))
.pollInterval(Duration.ofSeconds(2))
.until(() -> Files.exists(Paths.get("/tmp/common/Fat.class")) &&
Files.exists(Paths.get("/tmp/common/Normal1.class")) &&
Files.exists(Paths.get("/tmp/common/Normal2.class")));
createJar("Fat.class",
"common/Fat.class",
"common.Fat",
"fat.jar");
createJar("Normal1.class",
"common/Normal1.class",
"common.Normal1",
"normal1.jar");
createJar("Normal2.class",
"common/Normal2.class",
"common.Normal2",
"normal2.jar");

try {
Thread.sleep(60000);
} catch (InterruptedException e) {
log.error("Interrupted :", e);
}

/*
* createJar("Fat.class", "Fat.class", "Fat", "fat.jar"); createJar("Normal1.class", "Normal1.class", "Normal1",
* "normal1.jar"); createJar("Normal2.class", "Normal2.class", "Normal2", "normal2.jar");
*/

}

Expand All @@ -211,17 +205,17 @@ private static void compileJavaFlow() {
FileManagePage file = new NavBarPage(browser)
.goToNav(ResourcePage.class)
.goToTab(FileManagePage.class)
.uploadFile(getJavaPath("common/Fat.java"));
.uploadFile(getJavaPath("Fat.java"));

WebDriverWait wait = WebDriverWaitFactory.createWebDriverWait(browser);

wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[text()='Fat.java']")));

file.uploadFile(getJavaPath("common/Normal1.java"));
file.uploadFile(getJavaPath("Normal1.java"));

wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[text()='Normal1.java']")));

file.uploadFile(getJavaPath("common/Normal2.java"));
file.uploadFile(getJavaPath("Normal2.java"));

ProjectPage projectPage = new NavBarPage(browser)
.goToNav(ProjectPage.class);
Expand All @@ -235,11 +229,14 @@ private static void compileJavaFlow() {
String workflowName = "compile";
String taskName = "compile";
String context =
"$JAVA_HOME/bin/javac -d /tmp Fat.java \n" +
"$JAVA_HOME/bin/javac -d /tmp Normal1.java Normal2.java \n" +
"$JAVA_HOME/bin/javac -d /tmp Normal2.java \n"
+ "echo '####当前目录 ####'\n" + "ls\n"
+ "echo '#### /tmp/common 目录 ####'\n" + "ls /tmp/common\n";
"$JAVA_HOME/bin/javac Fat.java \n" +
"$JAVA_HOME/bin/jar cvf fat.jar Fat.class\n" +
"$JAVA_HOME/bin/javac Normal1.java Normal2.java \n" +
"$JAVA_HOME/bin/jar cvf normal1.jar Normal1.class\n" +
"$JAVA_HOME/bin/javac Normal2.java \n" +
"$JAVA_HOME/bin/jar cvf normal2.jar Normal2.class\n"
+ "mv *.jar /tmp/dolphinscheduler/runner/resources\n"
+ "echo '####编译文件目录 ####'\n" + "pwd\n" + "ls";
workflowDefinitionPage
.createWorkflow()
.<ShellTaskForm>addTask(WorkflowForm.TaskType.SHELL)
Expand Down Expand Up @@ -280,7 +277,7 @@ void testCreateFatWorkflow() {
FileManagePage file = new NavBarPage(browser)
.goToNav(ResourcePage.class)
.goToTab(FileManagePage.class)
.uploadFile(filePath + "/fat.jar");
.uploadFile(filePath + "fat.jar");

WebDriverWait wait = WebDriverWaitFactory.createWebDriverWait(browser);

Expand Down Expand Up @@ -356,13 +353,13 @@ void testCreateNormalWorkflow() {
FileManagePage file = new NavBarPage(browser)
.goToNav(ResourcePage.class)
.goToTab(FileManagePage.class)
.uploadFile(filePath + "/normal2.jar");
.uploadFile(filePath + "normal2.jar");

WebDriverWait wait = WebDriverWaitFactory.createWebDriverWait(browser);

wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[text()='normal2.jar']")));

file.uploadFile(filePath + "/normal1.jar");
file.uploadFile(filePath + "normal1.jar");

wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[text()='normal1.jar']")));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package common;


public class Fat {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package common;


public class Normal1 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package common;


public class Normal2 {

Expand Down

0 comments on commit 81b47d9

Please sign in to comment.