Commit e6a337f8 authored by Tim Olshansky's avatar Tim Olshansky

Merge pull request #29 from mfriedenhagen/integration-tests

Make integrative test run as during phase verify.
parents 6fbc5478 593c89df
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<parent> <parent>
<groupId>org.sonatype.oss</groupId> <groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId> <artifactId>oss-parent</artifactId>
<version>7</version> <version>9</version>
</parent> </parent>
<developers> <developers>
...@@ -61,6 +61,7 @@ ...@@ -61,6 +61,7 @@
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties> </properties>
<dependencies> <dependencies>
...@@ -104,6 +105,30 @@ ...@@ -104,6 +105,30 @@
<target>1.6</target> <target>1.6</target>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.17</version>
<executions>
<execution>
<id>default-integration-test</id>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>default-verify</id>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins> </plugins>
</build> </build>
</project> </project>
...@@ -11,21 +11,34 @@ import java.net.URL; ...@@ -11,21 +11,34 @@ import java.net.URL;
import java.util.UUID; import java.util.UUID;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assume.assumeNoException;
public class GitlabAPITest { import java.net.ConnectException;
public class GitlabAPIT {
GitlabAPI _api; GitlabAPI _api;
private static final String TEST_URL = "http://localhost"; private static final String TEST_URL = System.getProperty("TEST_URL", "http://localhost");
private static final String TEST_TOKEN = "y0E5b9761b7y4qk"; private static final String TEST_TOKEN = System.getProperty("TEST_TOKEN", "y0E5b9761b7y4qk");
String rand = UUID.randomUUID().toString().replace("-", "").substring(0, 8); String rand = UUID.randomUUID().toString().replace("-", "").substring(0, 8);
@Before @Before
public void setup() { public void setup() throws IOException {
_api = GitlabAPI.connect(TEST_URL, TEST_TOKEN); _api = GitlabAPI.connect(TEST_URL, TEST_TOKEN);
try {
_api.dispatch().with("login", "INVALID").with("password", rand).to("session", GitlabUser.class);
} catch (ConnectException e) {
assumeNoException("GITLAB not running on '" + TEST_URL + "', skipping...", e);
} catch (IOException e) {
final String message = e.getMessage();
if (!message.equals("{\"message\":\"401 Unauthorized\"}")) {
throw new AssertionError("Expected an unauthorized message", e);
}
}
} }
@Test @Test
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment