Skip to content

Commit

Permalink
Updating the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Vahila committed Jul 16, 2024
1 parent 313d60d commit 0b45d32
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 14 deletions.
5 changes: 4 additions & 1 deletion src/integ-test/java/com/mathworks/ci/DockerSupportIT.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package com.mathworks.ci;

import com.mathworks.ci.freestyle.RunMatlabCommandBuilder;
import com.mathworks.ci.freestyle.RunMatlabTestsBuilder;
import com.mathworks.ci.freestyle.options.SourceFolder;
import com.mathworks.ci.freestyle.options.SourceFolderPaths;
import com.sun.akuma.CLibrary;
import hudson.FilePath;
import hudson.model.WorkspaceBrowser;
Expand Down Expand Up @@ -28,7 +32,6 @@
import java.net.URISyntaxException;
import java.net.URL;
import java.util.*;
import java.util.concurrent.TimeUnit;

import org.apache.commons.lang3.StringUtils;
import jenkins.model.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.concurrent.TimeUnit;

public class FilterTestFolderIT {
private WorkflowJob project;
Expand Down
2 changes: 1 addition & 1 deletion src/integ-test/java/com/mathworks/ci/GlobalToolIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.gargoylesoftware.htmlunit.WebAssert;
import com.gargoylesoftware.htmlunit.html.*;
import com.mathworks.ci.freestyle.RunMatlabCommandBuilder;
import hudson.matrix.*;
import hudson.model.FreeStyleBuild;
import hudson.model.FreeStyleProject;
Expand All @@ -19,7 +20,6 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.TimeUnit;

import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertTrue;
Expand Down
3 changes: 2 additions & 1 deletion src/integ-test/java/com/mathworks/ci/PersistentIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlTextInput;
import com.mathworks.ci.freestyle.RunMatlabTestsBuilder;
import com.mathworks.ci.freestyle.options.SourceFolderPaths;
import groovy.util.GroovyTestCase;
import hudson.model.FreeStyleBuild;
import hudson.model.FreeStyleProject;
Expand All @@ -16,7 +18,6 @@

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
Expand Down
1 change: 0 additions & 1 deletion src/integ-test/java/com/mathworks/ci/PipelineIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.concurrent.TimeUnit;

import static org.jvnet.hudson.test.JenkinsRule.getLog;

Expand Down
10 changes: 5 additions & 5 deletions src/integ-test/java/com/mathworks/ci/RunMATLABCommandIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.gargoylesoftware.htmlunit.*;
import com.gargoylesoftware.htmlunit.html.*;
import com.mathworks.ci.freestyle.RunMatlabCommandBuilder;
import hudson.model.FreeStyleBuild;
import hudson.model.FreeStyleProject;
import hudson.model.Result;
Expand Down Expand Up @@ -29,7 +30,6 @@
import java.net.URISyntaxException;
import java.net.URL;
import java.util.*;
import java.util.concurrent.TimeUnit;


public class RunMATLABCommandIT {
Expand Down Expand Up @@ -64,8 +64,8 @@ public void testTearDown() {

@Test
public void verifyBuildFailureWhenMatlabCommandFails() throws Exception {
// this.buildWrapper.setMatlabBuildWrapperContent(new MatlabBuildWrapperContent(Message.getValue("matlab.custom.location"), MatlabRootSetup.getMatlabRoot()));
// project.getBuildWrappersList().add(this.buildWrapper);
this.buildWrapper.setMatlabBuildWrapperContent(new MatlabBuildWrapperContent(Message.getValue("matlab.custom.location"), MatlabRootSetup.getMatlabRoot()));
project.getBuildWrappersList().add(this.buildWrapper);
RunMatlabCommandBuilder tester =
new RunMatlabCommandBuilder();
tester.setMatlabCommand(TestData.getPropValues("pwd"));
Expand All @@ -79,8 +79,8 @@ public void verifyBuildFailureWhenMatlabCommandFails() throws Exception {
*/
@Test
public void verifyBuildPassesWhenMatlabCommandPasses() throws Exception {
// this.buildWrapper.setMatlabBuildWrapperContent(new MatlabBuildWrapperContent(Message.getValue("matlab.custom.location"), MatlabRootSetup.getMatlabRoot()));
// project.getBuildWrappersList().add(this.buildWrapper);
this.buildWrapper.setMatlabBuildWrapperContent(new MatlabBuildWrapperContent(Message.getValue("matlab.custom.location"), MatlabRootSetup.getMatlabRoot()));
project.getBuildWrappersList().add(this.buildWrapper);
RunMatlabCommandBuilder tester =
new RunMatlabCommandBuilder();
tester.setMatlabCommand("version");
Expand Down
10 changes: 7 additions & 3 deletions src/integ-test/java/com/mathworks/ci/RunMATLABTestsIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

import com.gargoylesoftware.htmlunit.*;
import com.gargoylesoftware.htmlunit.html.*;
import com.mathworks.ci.freestyle.RunMatlabTestsBuilder;
import com.mathworks.ci.freestyle.options.SelectByFolder;
import com.mathworks.ci.freestyle.options.SourceFolder;
import com.mathworks.ci.freestyle.options.SourceFolderPaths;
import com.mathworks.ci.freestyle.options.TestFolders;
import hudson.model.FreeStyleBuild;
import hudson.model.FreeStyleProject;
import hudson.model.Result;
Expand All @@ -26,7 +31,6 @@
import java.net.URL;
import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;

import com.jcabi.xml.XML;
import com.jcabi.xml.XMLDocument;
Expand Down Expand Up @@ -88,7 +92,7 @@ public void verifyInvalidMATLABRootError() throws Exception{
HtmlPage configurePage = jenkins.createWebClient().goTo("job/test0/configure");
HtmlCheckBoxInput matlabver=configurePage.getElementByName("com-mathworks-ci-UseMatlabVersionBuildWrapper");
matlabver.setChecked(true);
WebAssert.assertTextPresent(configurePage, TestMessage.getValue("Builder.invalid.matlab.root.warning"));
WebAssert.assertTextPresent(configurePage, com.mathworks.ci.TestMessage.getValue("Builder.invalid.matlab.root.warning"));
}

@Test
Expand All @@ -114,7 +118,7 @@ public void verifyBuilderFailsForInvalidMATLABPath() throws Exception {
project.getBuildersList().add(this.testBuilder);

FreeStyleBuild build = project.scheduleBuild2(0).get();
jenkins.assertLogContains(TestMessage.getValue("matlab.not.found.error"), build);
jenkins.assertLogContains(com.mathworks.ci.TestMessage.getValue("matlab.not.found.error"), build);
jenkins.assertBuildStatus(Result.FAILURE, build);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import org.jvnet.hudson.test.JenkinsRule;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

public class StageFailureExceptionIT {
private WorkflowJob project;
Expand Down
4 changes: 4 additions & 0 deletions src/integ-test/java/com/mathworks/ci/StartupOptionsIT.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package com.mathworks.ci;

import com.mathworks.ci.freestyle.RunMatlabBuildBuilder;
import com.mathworks.ci.freestyle.RunMatlabCommandBuilder;
import com.mathworks.ci.freestyle.RunMatlabTestsBuilder;
import com.mathworks.ci.freestyle.options.*;
import hudson.FilePath;
import hudson.matrix.MatrixBuild;
import hudson.matrix.MatrixProject;
Expand Down

0 comments on commit 0b45d32

Please sign in to comment.