Use java.net.HttpURLConnection as category class for tests that require a network connection.

pull/17/merge
Richard Körber 2015-12-13 15:59:43 +01:00
parent 7097f23a2d
commit f88bdf7e5f
3 changed files with 14 additions and 18 deletions

View File

@ -28,21 +28,6 @@
<name>acme4j Let's Encrypt</name> <name>acme4j Let's Encrypt</name>
<description>Let's Encrypt service provider for acme4j</description> <description>Let's Encrypt service provider for acme4j</description>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19</version>
<configuration>
<parallel>classes</parallel>
<threadCount>10</threadCount>
<excludedGroups>org.shredzone.acme4j.provider.LetsEncryptAcmeClientProviderTest$RequiresNetwork</excludedGroups>
</configuration>
</plugin>
</plugins>
</build>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.shredzone.acme4j</groupId> <groupId>org.shredzone.acme4j</groupId>

View File

@ -36,8 +36,6 @@ import org.shredzone.acme4j.AcmeClient;
*/ */
public class LetsEncryptAcmeClientProviderTest { public class LetsEncryptAcmeClientProviderTest {
public interface RequiresNetwork {}
private static final String V01_DIRECTORY_URI = "https://acme-v01.api.letsencrypt.org/directory"; private static final String V01_DIRECTORY_URI = "https://acme-v01.api.letsencrypt.org/directory";
private static final String STAGING_DIRECTORY_URI = "https://acme-staging.api.letsencrypt.org/directory"; private static final String STAGING_DIRECTORY_URI = "https://acme-staging.api.letsencrypt.org/directory";
@ -111,9 +109,12 @@ public class LetsEncryptAcmeClientProviderTest {
/** /**
* Test if the {@link LetsEncryptAcmeClientProvider#openConnection(URI)} accepts only * Test if the {@link LetsEncryptAcmeClientProvider#openConnection(URI)} accepts only
* the Let's Encrypt certificate. * the Let's Encrypt certificate.
* <p>
* This test requires a network connection. It should be excluded from automated
* builds.
*/ */
@Test @Test
@Category(RequiresNetwork.class) @Category(HttpURLConnection.class)
public void testCertificate() throws IOException, URISyntaxException { public void testCertificate() throws IOException, URISyntaxException {
LetsEncryptAcmeClientProvider provider = new LetsEncryptAcmeClientProvider(); LetsEncryptAcmeClientProvider provider = new LetsEncryptAcmeClientProvider();

10
pom.xml
View File

@ -75,6 +75,16 @@
<target>1.7</target> <target>1.7</target>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19</version>
<configuration>
<parallel>classes</parallel>
<threadCount>10</threadCount>
<excludedGroups>java.net.HttpURLConnection</excludedGroups>
</configuration>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>