Skip to content

Commit e2021cd

Browse files
authored
Merge pull request #76 from mpkorstanje/master
Add explicit dependency on JaxB
2 parents 2be61e1 + df6afa7 commit e2021cd

File tree

4 files changed

+56
-34
lines changed

4 files changed

+56
-34
lines changed

pom.xml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,24 @@
9090
</properties>
9191

9292
<dependencies>
93+
<!--JaxB-->
94+
<dependency>
95+
<groupId>javax.xml.bind</groupId>
96+
<artifactId>jaxb-api</artifactId>
97+
<version>2.3.0</version>
98+
</dependency>
99+
<dependency>
100+
<groupId>org.glassfish.jaxb</groupId>
101+
<artifactId>jaxb-runtime</artifactId>
102+
<version>2.3.0</version>
103+
</dependency>
104+
<dependency>
105+
<groupId>javax.activation</groupId>
106+
<artifactId>activation</artifactId>
107+
<version>1.1.1</version>
108+
</dependency>
109+
110+
<!--Maven -->
93111
<dependency>
94112
<groupId>org.apache.maven</groupId>
95113
<artifactId>maven-core</artifactId>
@@ -105,6 +123,8 @@
105123
<artifactId>maven-plugin-annotations</artifactId>
106124
<version>3.4</version>
107125
</dependency>
126+
127+
<!--Misc -->
108128
<dependency>
109129
<groupId>commons-io</groupId>
110130
<artifactId>commons-io</artifactId>
@@ -191,7 +211,7 @@
191211
<plugin>
192212
<groupId>org.apache.maven.plugins</groupId>
193213
<artifactId>maven-plugin-plugin</artifactId>
194-
<version>3.3</version>
214+
<version>3.5</version>
195215
<configuration>
196216
<!-- TODO: workaround for http://jira.codehaus.org/browse/MNG-5346 -->
197217
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>

src/main/java/com/lazerycode/selenium/extract/FileExtractor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
import java.io.FileInputStream;
1717
import java.io.IOException;
1818
import java.io.InputStream;
19-
import java.util.ArrayList;
2019
import java.util.Enumeration;
20+
import java.util.List;
2121

2222
import static com.lazerycode.selenium.extract.DownloadableFileType.TAR;
2323

@@ -81,7 +81,7 @@ public String extractFileFromArchive(File downloadedCompressedFile, String extra
8181

8282
String unzipFile(File downloadedCompressedFile, String extractedToFilePath, BinaryType possibleFilenames) throws IOException, ExpectedFileNotFoundException {
8383
LOG.debug("Attempting to extract binary from .zip file...");
84-
ArrayList<String> filenamesWeAreSearchingFor = possibleFilenames.getBinaryFilenames();
84+
List<String> filenamesWeAreSearchingFor = possibleFilenames.getBinaryFilenames();
8585
ZipFile zip = new ZipFile(downloadedCompressedFile);
8686
try {
8787
Enumeration<ZipArchiveEntry> zipFile = zip.getEntries();
@@ -114,7 +114,7 @@ String unzipFile(File downloadedCompressedFile, String extractedToFilePath, Bina
114114
private String untarFile(InputStream compressedFileInputStream, String extractedToFilePath, BinaryType possibleFilenames) throws IOException, ExpectedFileNotFoundException {
115115
LOG.debug("Attempting to extract binary from a .tar file...");
116116
ArchiveEntry currentFile;
117-
ArrayList<String> filenamesWeAreSearchingFor = possibleFilenames.getBinaryFilenames();
117+
List<String> filenamesWeAreSearchingFor = possibleFilenames.getBinaryFilenames();
118118
ArchiveInputStream archiveInputStream = new TarArchiveInputStream(compressedFileInputStream);
119119
try {
120120
while ((currentFile = archiveInputStream.getNextEntry()) != null) {

src/main/java/com/lazerycode/selenium/repository/BinaryType.java

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,56 @@
11
package com.lazerycode.selenium.repository;
22

3-
import java.util.ArrayList;
3+
import java.util.List;
4+
5+
import static java.util.Arrays.asList;
46

57
public enum BinaryType {
68
INTERNETEXPLORER(
7-
new ArrayList<String>() {{
8-
add("IEDriverServer.exe");
9-
}},
9+
asList(
10+
"IEDriverServer.exe"
11+
),
1012
"webdriver.ie.driver"),
1113
GOOGLECHROME(
12-
new ArrayList<String>() {{
13-
add("chromedriver.exe");
14-
add("chromedriver");
15-
}},
14+
asList(
15+
"chromedriver.exe",
16+
"chromedriver"
17+
),
1618
"webdriver.chrome.driver"),
1719
PHANTOMJS(
18-
new ArrayList<String>() {{
19-
add("phantomjs.exe");
20-
add("phantomjs");
21-
}},
20+
asList(
21+
"phantomjs.exe",
22+
"phantomjs"
23+
),
2224
"phantomjs.binary.path"),
2325
OPERACHROMIUM(
24-
new ArrayList<String>() {{
25-
add("operadriver.exe");
26-
add("operadriver");
27-
}},
26+
asList(
27+
"operadriver.exe",
28+
"operadriver"
29+
),
2830
"webdriver.opera.driver"),
2931
MARIONETTE(
30-
new ArrayList<String>() {{
31-
add("wires");
32-
add("wires.exe");
33-
add("geckodriver");
34-
add("geckodriver.exe");
35-
}},
32+
asList(
33+
"wires",
34+
"wires.exe",
35+
"geckodriver",
36+
"geckodriver.exe"
37+
),
3638
"webdriver.gecko.driver"),
3739
EDGE(
38-
new ArrayList<String>() {{
39-
add("MicrosoftWebDriver.exe");
40-
}},
40+
asList(
41+
"MicrosoftWebDriver.exe"
42+
),
4143
"webdriver.edge.driver");
4244

43-
private final ArrayList<String> binaryFilenames;
45+
private final List<String> binaryFilenames;
4446
private final String driverSystemProperty;
4547

46-
BinaryType(ArrayList<String> binaryFilenames, String driverSystemProperty) {
48+
BinaryType(List<String> binaryFilenames, String driverSystemProperty) {
4749
this.binaryFilenames = binaryFilenames;
4850
this.driverSystemProperty = driverSystemProperty;
4951
}
5052

51-
public ArrayList<String> getBinaryFilenames() {
53+
public List<String> getBinaryFilenames() {
5254
return binaryFilenames;
5355
}
5456

src/test/java/com/lazerycode/selenium/repository/BinaryTypeTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import org.junit.Test;
44

5-
import java.util.ArrayList;
5+
import java.util.List;
66

77
import static com.lazerycode.selenium.repository.BinaryType.GOOGLECHROME;
88
import static com.lazerycode.selenium.repository.BinaryType.PHANTOMJS;
@@ -14,7 +14,7 @@ public class BinaryTypeTest {
1414

1515
@Test
1616
public void willReturnAListOfFilenameAssociatedWithBinary() {
17-
ArrayList<String> binaryFilenames = PHANTOMJS.getBinaryFilenames();
17+
List<String> binaryFilenames = PHANTOMJS.getBinaryFilenames();
1818

1919
assertThat(binaryFilenames.size(),
2020
is(equalTo(2)));

0 commit comments

Comments
 (0)