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 30, 2024
1 parent b1f2250 commit 5ff4481
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 30 deletions.
Original file line number Diff line number Diff line change
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,22 +171,25 @@ 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")));
FileManagePage file = new NavBarPage(browser)
.goToNav(ResourcePage.class)
.goToTab(FileManagePage.class);
WebDriverWait wait = WebDriverWaitFactory.createWebDriverWait(browser);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[text()='Fat.class']")));
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[text()='Normal1.class']")));
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[text()='Normal2.class']")));

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

}
Expand All @@ -211,17 +214,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 +238,10 @@ 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/javac Normal1.java Normal2.java \n" +
"$JAVA_HOME/bin/javac Normal2.java \n"
+ "echo '####当前目录 ####'\n" + "ls\n";
workflowDefinitionPage
.createWorkflow()
.<ShellTaskForm>addTask(WorkflowForm.TaskType.SHELL)
Expand Down Expand Up @@ -279,14 +281,15 @@ private static void compileJavaFlow() {
void testCreateFatWorkflow() {
FileManagePage file = new NavBarPage(browser)
.goToNav(ResourcePage.class)
.goToTab(FileManagePage.class)
.uploadFile(filePath + "/fat.jar");
.goToTab(FileManagePage.class);
/* .uploadFile(filePath + "/fat.jar"); */

WebDriverWait wait = WebDriverWaitFactory.createWebDriverWait(browser);

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

file.delete("Fat.java").delete("Normal1.java").delete("Normal2.java");
file.delete("Fat.java").delete("Normal1.java").delete("Normal2.java")
.delete("Fat.class").delete("Normal1.class").delete("Normal2.class");

ProjectPage projectPage = new NavBarPage(browser)
.goToNav(ProjectPage.class);
Expand Down Expand Up @@ -355,14 +358,14 @@ void testRunFatWorkflow() {
void testCreateNormalWorkflow() {
FileManagePage file = new NavBarPage(browser)
.goToNav(ResourcePage.class)
.goToTab(FileManagePage.class)
.uploadFile(filePath + "/normal2.jar");
.goToTab(FileManagePage.class);
// .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 5ff4481

Please sign in to comment.