diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..29cfcb1
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,91 @@
+##############################
+## Previously not committed
+##############################
+nextBuildNumber
+
+##############################
+## Java
+##############################
+.mtj.tmp/
+*.class
+*.jar
+!auto-circleci-plugin*.jar
+*.war
+*.ear
+*.nar
+hs_err_pid*
+replay_pid*
+
+##############################
+## Maven
+##############################
+target/
+pom.xml.tag
+pom.xml.releaseBackup
+pom.xml.versionsBackup
+pom.xml.next
+pom.xml.bak
+release.properties
+dependency-reduced-pom.xml
+buildNumber.properties
+.mvn/timing.properties
+.mvn/wrapper/maven-wrapper.jar
+
+##############################
+## Gradle
+##############################
+bin/
+build/
+.gradle
+.gradletasknamecache
+gradle-app.setting
+!gradle-wrapper.jar
+
+##############################
+## IntelliJ
+##############################
+out/
+.idea/
+.idea_modules/
+*.iml
+*.ipr
+*.iws
+
+##############################
+## Eclipse
+##############################
+.settings/
+bin/
+tmp/
+.metadata
+.classpath
+.project
+*.tmp
+*.bak
+*.swp
+*~.nib
+local.properties
+.loadpath
+.factorypath
+
+##############################
+## NetBeans
+##############################
+nbproject/private/
+build/
+nbbuild/
+dist/
+nbdist/
+nbactions.xml
+nb-configuration.xml
+
+##############################
+## Visual Studio Code
+##############################
+.vscode/
+.code-workspace
+
+##############################
+## OS X
+##############################
+.DS_Store
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 8f99bff..aa91495 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,172 +1,181 @@
- 4.0.0
-
- org.jenkins-ci.plugins
- plugin
- 3.4
-
-
- io.jenkins.plugins
- nowsecure-auto-security-test
- 1.26-SNAPSHOT
- hpi
-
- 2.7.3
- 8
-
- NowSecure Auto Plugin
- Send an Android or iOS applications to NowSecure Auto for Mobile Application Security Testing
-
-
- MIT License
- https://opensource.org/licenses/MIT
-
-
-
-
-
- org.apache.maven.plugins
- maven-dependency-plugin
-
-
- install-jar
- install
-
- copy
-
-
-
-
- com.nowsecure
- auto-circleci-plugin
- 0.4
- jar
- true
-
-
- ${project.build.directory}/dist/lib
- true
-
-
-
-
-
- org.apache.maven.plugins
- maven-jar-plugin
-
-
-
- true
-
-
-
-
-
-
-
- src/main/resources
- true
-
- **/jversion.txt
-
-
-
- src/main/resources
- false
-
- **/jversion.txt
-
-
-
-
-
-
- com.nowsecure
- auto-circleci-plugin
- 1.1.0
- system
- ${project.basedir}/src/main/webapp/WEB-INF/lib/auto-circleci-plugin-1.1.0.jar
-
-
- com.googlecode.json-simple
- json-simple
- 1.1
-
-
- org.jenkins-ci.plugins
- structs
- 1.7
-
-
- org.jenkins-ci.plugins.workflow
- workflow-step-api
- 2.12
- test
-
-
- org.jenkins-ci.plugins.workflow
- workflow-cps
- 2.39
- test
-
-
- org.jenkins-ci.plugins.workflow
- workflow-job
- 2.11.2
- test
-
-
- org.jenkins-ci.plugins.workflow
- workflow-basic-steps
- 2.6
- test
-
-
- org.jenkins-ci.plugins.workflow
- workflow-durable-task-step
- 2.13
- test
-
-
- org.jenkins-ci.plugins.workflow
- workflow-api
- 2.20
- test
-
-
- org.jenkins-ci.plugins.workflow
- workflow-support
- 2.14
- test
-
-
+ 4.0.0
+
+ org.jenkins-ci.plugins
+ plugin
+ 3.4
+
+
+ io.jenkins.plugins
+ nowsecure-auto-security-test
+ 1.26-SNAPSHOT
+ hpi
+
+ 2.7.3
+ 8
+ 1.2.1
+ ${project.basedir}/src/repository/
+
+ NowSecure Auto Plugin
+ Send an Android or iOS applications to NowSecure Auto for Mobile Application Security Testing
+
+
+ MIT License
+ https://opensource.org/licenses/MIT
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+
+
+ install-jar
+ install
+
+ copy
+
+
+
+
+ com.nowsecure
+ auto-circleci-plugin
+ ${auto-circleci-plugin.version}
+ jar
+ true
+
+
+ ${auto-circleci-plugin.local.path}
+ ${project.build.directory}/dist/lib
+ true
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+
+
+
+ true
+
+
+
+
+
+
+
+ src/main/resources
+ true
+
+ **/jversion.txt
+
+
+
+ src/main/resources
+ false
+
+ **/jversion.txt
+
+
+
+
+
+
+ com.nowsecure
+ auto-circleci-plugin
+ ${auto-circleci-plugin.version}
+
+
+ com.googlecode.json-simple
+ json-simple
+ 1.1
+
+
+ org.jenkins-ci.plugins
+ structs
+ 1.7
+
+
+ org.jenkins-ci.plugins.workflow
+ workflow-step-api
+ 2.12
+ test
+
+
+ org.jenkins-ci.plugins.workflow
+ workflow-cps
+ 2.39
+ test
+
+
+ org.jenkins-ci.plugins.workflow
+ workflow-job
+ 2.11.2
+ test
+
+
+ org.jenkins-ci.plugins.workflow
+ workflow-basic-steps
+ 2.6
+ test
+
+
+ org.jenkins-ci.plugins.workflow
+ workflow-durable-task-step
+ 2.13
+ test
+
+
+ org.jenkins-ci.plugins.workflow
+ workflow-api
+ 2.20
+ test
+
+
+ org.jenkins-ci.plugins.workflow
+ workflow-support
+ 2.14
+ test
+
+
-
-
- bhatti
- NowSecure, Inc.
- info@nowsecure.com
-
-
+
+
+ bhatti
+ NowSecure, Inc.
+ info@nowsecure.com
+
+
-
- scm:git:git://github.com/jenkinsci/${project.artifactId}-plugin.git
- scm:git:git@github.com:jenkinsci/${project.artifactId}-plugin.git
- https://github.com/jenkinsci/${project.artifactId}-plugin
- HEAD
-
- https://wiki.jenkins.io/display/JENKINS/NowSecure+AUTO+Jenkins+Plugin
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
+
+ scm:git:git://github.com/jenkinsci/${project.artifactId}-plugin.git
+ scm:git:git@github.com:jenkinsci/${project.artifactId}-plugin.git
+ https://github.com/jenkinsci/${project.artifactId}-plugin
+ HEAD
+
+ https://wiki.jenkins.io/display/JENKINS/NowSecure+AUTO+Jenkins+Plugin
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+ circle-ci
+ file:///${auto-circleci-plugin.local.path}
+
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+ circle-ci
+ file:///${auto-circleci-plugin.local.path}
+
+
+
\ No newline at end of file
diff --git a/src/main/java/com/nowsecure/auto/jenkins/plugin/NSAutoPlugin.java b/src/main/java/com/nowsecure/auto/jenkins/plugin/NSAutoPlugin.java
index 49667ee..5761cb5 100644
--- a/src/main/java/com/nowsecure/auto/jenkins/plugin/NSAutoPlugin.java
+++ b/src/main/java/com/nowsecure/auto/jenkins/plugin/NSAutoPlugin.java
@@ -80,7 +80,7 @@ public class NSAutoPlugin extends Builder implements SimpleBuildStep, NSAutoPara
private ProxySettings proxySettings = new ProxySettings();
private boolean debug;
private boolean proxyEnabled;
- private Boolean validateDnsUrlConnection = true;
+ private Boolean validateDnsUrlConnectionEnabled = true;
private static class Logger implements NSAutoLogger, Serializable {
private static final long serialVersionUID = 1L;
@@ -132,7 +132,7 @@ public void debug(String msg) {
@DataBoundConstructor
public NSAutoPlugin(String apiUrl, String group, String binaryName, String description, boolean waitForResults,
int waitMinutes, boolean breakBuildOnScore, int scoreThreshold, String apiKey, boolean useBuildEndpoint,
- boolean validateDnsUrlConnection) {
+ boolean validateDnsUrlConnectionEnabled) {
this.apiUrl = apiUrl;
this.group = group;
this.binaryName = binaryName;
@@ -143,7 +143,7 @@ public NSAutoPlugin(String apiUrl, String group, String binaryName, String descr
this.scoreThreshold = scoreThreshold;
this.apiKey = apiKey;
this.useBuildEndpoint = useBuildEndpoint;
- this.validateDnsUrlConnection = validateDnsUrlConnection;
+ this.validateDnsUrlConnectionEnabled = validateDnsUrlConnectionEnabled;
}
/*
@@ -362,17 +362,18 @@ public void setProxyEnabled(boolean proxyEnabled) {
this.proxyEnabled = proxyEnabled;
}
+
@Override
public boolean isValidateDnsUrlConnectionEnabled() {
- if (validateDnsUrlConnection == null) {
- validateDnsUrlConnection = true;
+ if (validateDnsUrlConnectionEnabled == null) {
+ validateDnsUrlConnectionEnabled = true;
}
- return validateDnsUrlConnection;
+ return validateDnsUrlConnectionEnabled;
}
@DataBoundSetter
- public void setValidateDnsUrlConnectionEnabled(boolean validateDnsUrlConnection) {
- this.validateDnsUrlConnection = validateDnsUrlConnection;
+ public void setValidateDnsUrlConnectionEnabled(boolean validateDnsUrlConnectionEnabled) {
+ this.validateDnsUrlConnectionEnabled = validateDnsUrlConnectionEnabled;
}
@SuppressWarnings("deprecation")
@@ -496,7 +497,7 @@ private static Map execute(final TaskListener listener, ParamsAd
}
- @Symbol({ "apiKey", "apiUrl", "binaryName", "group", "artifactsDir" })
+ @Symbol({"NowSecure-Auto-Plugin"})
@Extension
public static final class DescriptorImpl extends BuildStepDescriptor {
public FormValidation doValidateParams(@QueryParameter("apiKey") String apiKey,
diff --git a/src/main/webapp/WEB-INF/lib/auto-circleci-plugin-1.1.0.jar b/src/main/webapp/WEB-INF/lib/auto-circleci-plugin-1.1.0.jar
deleted file mode 100644
index db209ab..0000000
Binary files a/src/main/webapp/WEB-INF/lib/auto-circleci-plugin-1.1.0.jar and /dev/null differ
diff --git a/src/repository/com/nowsecure/auto-circleci-plugin/1.2.1/auto-circleci-plugin-1.2.1.jar b/src/repository/com/nowsecure/auto-circleci-plugin/1.2.1/auto-circleci-plugin-1.2.1.jar
new file mode 100644
index 0000000..97023d4
Binary files /dev/null and b/src/repository/com/nowsecure/auto-circleci-plugin/1.2.1/auto-circleci-plugin-1.2.1.jar differ
diff --git a/src/repository/com/nowsecure/auto-circleci-plugin/1.2.1/auto-circleci-plugin-1.2.1.pom b/src/repository/com/nowsecure/auto-circleci-plugin/1.2.1/auto-circleci-plugin-1.2.1.pom
new file mode 100644
index 0000000..e02969d
--- /dev/null
+++ b/src/repository/com/nowsecure/auto-circleci-plugin/1.2.1/auto-circleci-plugin-1.2.1.pom
@@ -0,0 +1,6 @@
+
+ com.nowsecure
+ auto-circleci-plugin
+ 1.2.1
+ 4.0.0
+
\ No newline at end of file
diff --git a/src/test/java/com/nowsecure/auto/jenkins/plugin/NSAutoPluginTest.java b/src/test/java/com/nowsecure/auto/jenkins/plugin/NSAutoPluginTest.java
index f8649ef..0e6ccda 100644
--- a/src/test/java/com/nowsecure/auto/jenkins/plugin/NSAutoPluginTest.java
+++ b/src/test/java/com/nowsecure/auto/jenkins/plugin/NSAutoPluginTest.java
@@ -5,6 +5,7 @@
import java.io.StringWriter;
import java.util.Arrays;
import java.util.Collection;
+import java.util.Map;
import java.util.SortedMap;
import org.acegisecurity.AccessDeniedException;
@@ -147,7 +148,11 @@ protected void removeRun(Run run) {
};
Assert.assertNull(NSAutoPlugin.normalize(run, null));
Assert.assertEquals("test", NSAutoPlugin.normalize(run, "test"));
- Assert.assertNotEquals("${HOME}", NSAutoPlugin.normalize(run, "${HOME}"));
+ //if this does not exist, it will pass equals and fails here Is this a control test? Might as well check 'em all
+ Map envs = System.getenv();
+ for (String key : envs.keySet()) {
+ Assert.assertNotEquals("${" + key + "}", NSAutoPlugin.normalize(run, "${" + key + "}"));
+ }
Assert.assertEquals("${test}", NSAutoPlugin.normalize(run, "${test}"));
}
diff --git a/src/test/java/com/nowsecure/auto/jenkins/plugin/ParamsAdapterTest.java b/src/test/java/com/nowsecure/auto/jenkins/plugin/ParamsAdapterTest.java
index ecaa187..906dcac 100644
--- a/src/test/java/com/nowsecure/auto/jenkins/plugin/ParamsAdapterTest.java
+++ b/src/test/java/com/nowsecure/auto/jenkins/plugin/ParamsAdapterTest.java
@@ -1,12 +1,15 @@
package com.nowsecure.auto.jenkins.plugin;
import java.io.File;
+import java.io.FileWriter;
import java.io.IOException;
+import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import com.google.common.io.Files;
import com.nowsecure.auto.domain.NSAutoParameters;
import com.nowsecure.auto.domain.ProxySettings;
import com.nowsecure.auto.utils.IOHelper;
@@ -14,12 +17,16 @@
import hudson.AbortException;
public class ParamsAdapterTest implements NSAutoParameters {
- private String token = "token";
+ private static final String TEST_IPA_NAME = "test.ipa";
+ private static final String TEST_APK_NAME = "test.apk";
+
private String url = "https://lab-api.nowsecure.com";
- private File workspace = new File("/tmp");
- private File artifactsDir = new File("/tmp");
- private File file = new File("/tmp/test.apk");
- private String ipa = "/tmp/test.ipa";
+ private String token = "token";
+ private File workspace;
+ private File artifactsDir;
+ private File file;
+ private File ipaFile;
+ private File tmpDir;
private String username;
private String password;
private boolean showStatusMessages;
@@ -32,20 +39,44 @@ public class ParamsAdapterTest implements NSAutoParameters {
@Before
public void setup() throws IOException {
- new File(ipa).createNewFile();
- }
-
+ tmpDir = Files.createTempDir();
+ tmpDir.deleteOnExit();
+ artifactsDir = tmpDir;
+ workspace = tmpDir;
+ ipaFile = new File(tmpDir.getAbsolutePath() + "/" + TEST_IPA_NAME);
+ try (FileWriter writer = new FileWriter(ipaFile);) {
+ //cannot be zero length or verify of file may be false
+ writer.write("Hello world!");
+ }
+ ipaFile.deleteOnExit();
+ file = new File(workspace.getAbsolutePath() + "/" + TEST_APK_NAME);
+ try (FileWriter writer = new FileWriter(file);) {
+ //cannot be zero length or verify of file may be false
+ writer.write("Hello world!");
+ }
+ file.deleteOnExit();
+
+ }
+
+ @After
+ public void tearDown() {
+ ipaFile.delete();
+ file.delete();
+ tmpDir.delete();
+ artifactsDir.delete();
+ tmpDir.delete();
+ }
+
@Test
public void testConstructor() throws Exception {
- File dir = new File("/tmp/archive");
- ParamsAdapter param = new ParamsAdapter(this, "newToken", workspace, dir, ipa, true, true, "pluginName", "bill",
+ ParamsAdapter param = new ParamsAdapter(this, "newToken", tmpDir, tmpDir, ipaFile.getAbsolutePath(), true, true, "pluginName", "bill",
"pass", true, "stop", new ProxySettings(), true);
Assert.assertEquals("newToken", param.getApiKey());
Assert.assertNotNull(param.getApiUrl());
Assert.assertEquals("desc", param.getDescription());
Assert.assertEquals("group", param.getGroup());
- Assert.assertEquals(dir, param.getArtifactsDir());
- Assert.assertEquals(new File(ipa), param.getFile());
+ Assert.assertEquals(tmpDir, param.getArtifactsDir());
+ Assert.assertEquals(ipaFile, param.getFile());
Assert.assertEquals(30, param.getWaitMinutes());
Assert.assertEquals(70, param.getScoreThreshold());
Assert.assertEquals("pass", param.getPassword());
@@ -56,16 +87,15 @@ public void testConstructor() throws Exception {
@Test
public void testConstructorWithScore() throws Exception {
- File dir = new File("/tmp/archive");
- ParamsAdapter param = new ParamsAdapter(this, "newToken", workspace, dir, ipa, true, true, "pluginName",
+ ParamsAdapter param = new ParamsAdapter(this, "newToken", workspace, tmpDir, ipaFile.getAbsolutePath(), true, true, "pluginName",
username, password, showStatusMessages, stopTestsForStatusMessage, new ProxySettings(), false);
Assert.assertEquals("newToken", param.getApiKey());
Assert.assertNotNull(param.getApiUrl());
Assert.assertEquals("desc", param.getDescription());
Assert.assertEquals("group", param.getGroup());
- Assert.assertEquals(dir, param.getArtifactsDir());
- Assert.assertEquals(new File(ipa), param.getFile());
+ Assert.assertEquals(tmpDir, param.getArtifactsDir());
+ Assert.assertEquals(ipaFile, param.getFile());
score = 60;
minutes = 40;
Assert.assertEquals(40, param.getWaitMinutes());
@@ -74,45 +104,42 @@ public void testConstructorWithScore() throws Exception {
@Test
public void testConstructorWait() throws Exception {
- File dir = new File("/tmp/archive");
- ParamsAdapter param = new ParamsAdapter(this, "newToken", workspace, dir, ipa, false, true, "pluginName",
+ ParamsAdapter param = new ParamsAdapter(this, "newToken", workspace, tmpDir, ipaFile.getAbsolutePath(), false, true, "pluginName",
username, password, showStatusMessages, stopTestsForStatusMessage, new ProxySettings(), true);
Assert.assertEquals("newToken", param.getApiKey());
Assert.assertNotNull(param.getApiUrl());
Assert.assertEquals("desc", param.getDescription());
Assert.assertEquals("group", param.getGroup());
- Assert.assertEquals(dir, param.getArtifactsDir());
- Assert.assertEquals(new File(ipa), param.getFile());
+ Assert.assertEquals(tmpDir, param.getArtifactsDir());
+ Assert.assertEquals(ipaFile, param.getFile());
Assert.assertEquals(30, param.getWaitMinutes());
Assert.assertEquals(0, param.getScoreThreshold());
}
@Test
public void testConstructorScore() throws Exception {
- File dir = new File("/tmp/archive");
- ParamsAdapter param = new ParamsAdapter(this, "newToken", workspace, dir, ipa, true, false, "pluginName",
+ ParamsAdapter param = new ParamsAdapter(this, "newToken", workspace, tmpDir, ipaFile.getAbsolutePath(), true, false, "pluginName",
username, password, showStatusMessages, stopTestsForStatusMessage, new ProxySettings(), false);
Assert.assertEquals("newToken", param.getApiKey());
Assert.assertNotNull(param.getApiUrl());
Assert.assertEquals("desc", param.getDescription());
Assert.assertEquals("group", param.getGroup());
- Assert.assertEquals(dir, param.getArtifactsDir());
- Assert.assertEquals(new File(ipa), param.getFile());
+ Assert.assertEquals(tmpDir, param.getArtifactsDir());
+ Assert.assertEquals(ipaFile, param.getFile());
Assert.assertEquals(0, param.getWaitMinutes());
Assert.assertEquals(0, param.getScoreThreshold());
}
@Test
public void testConstructorNoWait() throws Exception {
- File dir = new File("/tmp/archive");
- ParamsAdapter param = new ParamsAdapter(this, "newToken", workspace, dir, ipa, false, false, "pluginName",
+ ParamsAdapter param = new ParamsAdapter(this, "newToken", workspace, tmpDir, ipaFile.getAbsolutePath(), false, false, "pluginName",
username, password, showStatusMessages, stopTestsForStatusMessage, new ProxySettings(), true);
Assert.assertEquals("newToken", param.getApiKey());
Assert.assertNotNull(param.getApiUrl());
Assert.assertEquals("desc", param.getDescription());
Assert.assertEquals("group", param.getGroup());
- Assert.assertEquals(dir, param.getArtifactsDir());
- Assert.assertEquals(new File(ipa), param.getFile());
+ Assert.assertEquals(tmpDir, param.getArtifactsDir());
+ Assert.assertEquals(ipaFile, param.getFile());
Assert.assertEquals(0, param.getWaitMinutes());
Assert.assertEquals(0, param.getScoreThreshold());
}
@@ -120,67 +147,63 @@ public void testConstructorNoWait() throws Exception {
@Test(expected = AbortException.class)
public void testConstructorNullToken() throws Exception {
token = null;
- new ParamsAdapter(this, null, new File("/tmp/archive"), new File("/tmp/test.ipa"), "binary ", true, true, null,
+ new ParamsAdapter(this, null, tmpDir, ipaFile, "binary ", true, true, null,
username, password, showStatusMessages, stopTestsForStatusMessage, new ProxySettings(), true);
}
@Test(expected = AbortException.class)
public void testConstructorBinary() throws Exception {
token = null;
- new ParamsAdapter(this, "xxxx", new File("/tmp/archive"), new File("/tmp/test.ipa"), null, true, true, null,
+ new ParamsAdapter(this, "xxxx", tmpDir, ipaFile, null, true, true, null,
username, password, showStatusMessages, stopTestsForStatusMessage, new ProxySettings(), false);
}
@Test(expected = AbortException.class)
public void testConstructorEmptyToken() throws Exception {
token = null;
- new ParamsAdapter(this, "", new File("/tmp/archive"), new File("/tmp/test.ipa"), "binary ", true, true, null,
+ new ParamsAdapter(this, "", tmpDir, ipaFile, "binary ", true, true, null,
username, password, showStatusMessages, stopTestsForStatusMessage, new ProxySettings(), true);
}
@Test
public void testHasFile() throws Exception {
- File dir = new File("/tmp/tmp");
- dir.mkdirs();
- File file = new File(dir, "tst");
- file.createNewFile();
- Assert.assertTrue(ParamsAdapter.hasFile(file.getParentFile(), new File("."), file.getName(), "name"));
- file.delete();
- dir.delete();
+ Assert.assertTrue(ParamsAdapter.hasFile(this.file.getParentFile(), new File("."), this.file.getName(), "name"));
}
@Test
public void testHasFileAbsoluteNonExistant() throws Exception {
- File dir = new File("/tmp/tmp");
- File file = new File("/tmp/xxx/xxx");
+ File differentDir = Files.createTempDir();
+ differentDir.deleteOnExit();
+ File tmpFile = new File(differentDir, "tmpxxxx");
+ tmpFile.createNewFile();
+ String tmpFilePath = tmpFile.getAbsolutePath();
+ tmpFile.deleteOnExit();
+ tmpFile.delete();
+ differentDir.delete();
+ System.out.println(tmpDir.getAbsolutePath());
+ System.out.println(tmpFile.getAbsolutePath());
Assert.assertFalse(
- ParamsAdapter.hasFile(file.getParentFile(), new File("/tmpxxxx"), file.getAbsolutePath(), "name"));
- file.delete();
- dir.delete();
+ ParamsAdapter.hasFile(workspace, tmpDir, tmpFilePath, "name"));
}
@Test
public void testHasFileAbsolute() throws Exception {
- File dir = new File("/tmp/tmp");
- dir.mkdirs();
- File file = new File(dir, "tst");
+ File file = new File(tmpDir, "tst");
file.createNewFile();
- Assert.assertTrue(ParamsAdapter.hasFile(file.getParentFile(), new File("."), file.getAbsolutePath(), "name"));
+ file.deleteOnExit();
+ Assert.assertTrue(ParamsAdapter.hasFile(tmpDir, new File("."), file.getAbsolutePath(), "name"));
file.delete();
- dir.delete();
}
@Test
public void testHasFileNonExistant() throws Exception {
- File dir = new File("/tmp/tmp");
- File file = new File(dir, "tst");
- Assert.assertFalse(ParamsAdapter.hasFile(file.getParentFile(), dir, file.getName(), "name"));
- dir.delete();
+ File file = new File(tmpDir, "tst");
+ Assert.assertFalse(ParamsAdapter.hasFile(file.getParentFile(), tmpDir, file.getName(), "name"));
}
@Test
public void testToString() throws Exception {
- ParamsAdapter params = new ParamsAdapter(this, "", new File("/tmp/archive"), new File("/tmp/test.ipa"),
+ ParamsAdapter params = new ParamsAdapter(this, "", tmpDir, ipaFile,
"binary ", true, true, null, username, password, showStatusMessages, stopTestsForStatusMessage,
new ProxySettings(), true);
Assert.assertNotNull(params.toString());