Skip to content

Commit

Permalink
Revert "SDK-357 - Follow maven recommended best practices for unit an…
Browse files Browse the repository at this point in the history
…d integration tests (#307)"

This reverts commit 76fb2be.
  • Loading branch information
mseaton committed Nov 18, 2024
1 parent 76fb2be commit 105f3eb
Show file tree
Hide file tree
Showing 56 changed files with 89 additions and 44 deletions.
12 changes: 12 additions & 0 deletions integration-tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
*.iml
target/
.idea/
*~
/openmrs-sdk.bat

*.class

/.settings
/.project
/.classpath
.DS_Store
50 changes: 50 additions & 0 deletions integration-tests/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.openmrs.maven</groupId>
<artifactId>openmrs-sdk</artifactId>
<version>6.1.0-SNAPSHOT</version>
</parent>

<artifactId>openmrs-sdk-integration-tests</artifactId>

<name>OpenMRS SDK Integration Tests</name>
<description>Set of integration tests for OpenMRS SDK Maven Plugin</description>
<url>https://wiki.openmrs.org/display/docs/OpenMRS+SDK</url>

<dependencies>
<!-- openmrs sdk maven plugin -->
<dependency>
<groupId>org.openmrs.maven.plugins</groupId>
<artifactId>openmrs-sdk-maven-plugin</artifactId>
<version>${project.parent.version}</version>
</dependency>
<!--testing-->
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-verifier</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.semver4j</groupId>
<artifactId>semver4j</artifactId>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.openmrs.maven.plugins;

import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.maven.it.VerificationException;
import org.apache.maven.it.Verifier;
Expand Down Expand Up @@ -47,7 +48,7 @@


@RunWith(BlockJUnit4ClassRunner.class)
public abstract class AbstractSdkIT {
public abstract class AbstractSdkIntegrationTest {

/**
* contains name of directory in project's target dir, where integration tests are conducted
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
import org.openmrs.maven.plugins.model.DistroProperties;
import org.openmrs.maven.plugins.utility.DistroHelper;

import java.io.File;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

public class AddDependencyIT extends AbstractSdkIT {
public class AddDependencyTest extends AbstractSdkIntegrationTest {

@Test
public void shouldAddOmodDependency() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

public class AddExclusionIT extends AbstractSdkIT {
public class AddExclusionIntegrationTest extends AbstractSdkIntegrationTest {

public DistroProperties getDistroProperties() {
return DistroHelper.getDistroPropertiesFromFile(distroFile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.junit.Test;

public class BuildDistroIT extends AbstractSdkIT {
public class BuildDistroIntegrationTest extends AbstractSdkIntegrationTest {

@Test
public void testBuildDistroFromDistroFile() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import java.io.File;

public class BuildIT extends AbstractSdkIT {
public class BuildIntegrationTest extends AbstractSdkIntegrationTest {

private String serverId;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import static org.hamcrest.CoreMatchers.hasItem;
import static org.hamcrest.MatcherAssert.assertThat;

public class CloneIT extends AbstractSdkIT {
public class CloneIntegrationTest extends AbstractSdkIntegrationTest {

@Test
public void clone_shouldCloneRepository() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.junit.Before;
import org.junit.Test;

public class CreateProjectIT extends AbstractSdkIT {
public class CreateProjectIntegrationTest extends AbstractSdkIntegrationTest {

Model model;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.openmrs.maven.plugins;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openmrs.maven.plugins.model.Artifact;
Expand All @@ -15,7 +16,7 @@
import static org.openmrs.maven.plugins.SdkMatchers.hasUserOwa;
import static org.openmrs.maven.plugins.SdkMatchers.serverHasVersion;

public class DeployIT extends AbstractSdkIT {
public class DeployIntegrationTest extends AbstractSdkIntegrationTest {

private static String testServerId;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import java.io.File;

public class FetchIT extends AbstractSdkIT {
public class FetchIntegrationTest extends AbstractSdkIntegrationTest{

private final static String FETCH_DIRECTORY_NAME = "fetch";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import java.io.File;

public class PullIT extends AbstractSdkIT {
public class PullIntegrationTest extends AbstractSdkIntegrationTest {

private static final String OPENMRS_MODULE_IDGEN = "openmrs-module-idgen";
private static final String PULL_GOAL = "pull";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

public class RemoveDependencyIT extends AbstractSdkIT {
public class RemoveDependencyTest extends AbstractSdkIntegrationTest {

@Test
public void shouldRemoveExistingDependency() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
package org.openmrs.maven.plugins;

import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat;

import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.UUID;

import org.apache.commons.io.FileUtils;
import org.junit.Test;

public class ResetIT extends AbstractSdkIT {
public class ResetIntegrationTest extends AbstractSdkIntegrationTest {

@Test
public void reset_shouldResetExistingServer() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import static org.openmrs.maven.plugins.SdkMatchers.serverHasDebugPort;
import static org.openmrs.maven.plugins.SdkMatchers.serverHasVersion;

public class SetupIT extends AbstractSdkIT {
public class SetupIntegrationTest extends AbstractSdkIntegrationTest {

@Test
public void setup_shouldInstallRefapp2_3_1() throws Exception{
Expand Down
34 changes: 3 additions & 31 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<module>tomcat7-maven-plugin</module>
<module>tomcat9-maven-plugin</module>
<module>maven-plugin</module>
<module>integration-tests</module>
</modules>

<licenses>
Expand Down Expand Up @@ -529,10 +530,6 @@
<artifactId>maven-gpg-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!--
The surefire plugin will execute any tests all classes whose name starts with Test,
or ends with Test, Tests or TestCase. Unit tests should follow this convention.
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Expand All @@ -546,39 +543,14 @@
</build>

<profiles>
<!--
The failsafe plugin will execute any tests that start with IT or ends with IT or ITCase
These are much slower to execute than unit tests, so they are only executed with the given profile
when full testing is desired. Integration Tests should follow this convention
-->
<profile>
<id>integration-tests</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.1.2</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<version>3.3.0</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -591,7 +563,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.4.1</version>
<version>3.5.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand Down

0 comments on commit 105f3eb

Please sign in to comment.