Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDK-357 - Follow maven recommended best practices for unit and integr… #307

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions integration-tests/.gitignore

This file was deleted.

50 changes: 0 additions & 50 deletions integration-tests/pom.xml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
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 @@ -48,7 +47,7 @@


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

/**
* 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,13 +4,11 @@
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 AddDependencyTest extends AbstractSdkIntegrationTest {
public class AddDependencyIT extends AbstractSdkIT {

@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 AddExclusionIntegrationTest extends AbstractSdkIntegrationTest {
public class AddExclusionIT extends AbstractSdkIT {

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 BuildDistroIntegrationTest extends AbstractSdkIntegrationTest {
public class BuildDistroIT extends AbstractSdkIT {

@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 BuildIntegrationTest extends AbstractSdkIntegrationTest {
public class BuildIT extends AbstractSdkIT {

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 CloneIntegrationTest extends AbstractSdkIntegrationTest {
public class CloneIT extends AbstractSdkIT {

@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 CreateProjectIntegrationTest extends AbstractSdkIntegrationTest {
public class CreateProjectIT extends AbstractSdkIT {

Model model;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
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 @@ -16,7 +15,7 @@
import static org.openmrs.maven.plugins.SdkMatchers.hasUserOwa;
import static org.openmrs.maven.plugins.SdkMatchers.serverHasVersion;

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

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 FetchIntegrationTest extends AbstractSdkIntegrationTest{
public class FetchIT extends AbstractSdkIT {

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 PullIntegrationTest extends AbstractSdkIntegrationTest {
public class PullIT extends AbstractSdkIT {

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 RemoveDependencyTest extends AbstractSdkIntegrationTest {
public class RemoveDependencyIT extends AbstractSdkIT {

@Test
public void shouldRemoveExistingDependency() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
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 ResetIntegrationTest extends AbstractSdkIntegrationTest {
public class ResetIT extends AbstractSdkIT {

@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 SetupIntegrationTest extends AbstractSdkIntegrationTest {
public class SetupIT extends AbstractSdkIT {

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

<licenses>
Expand Down Expand Up @@ -530,6 +529,10 @@
<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 @@ -543,14 +546,39 @@
</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.3.0</version>
<version>3.2.1</version>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really sure of the impact of this, but my IDE displayed errors with the 3.3.0 version, maybe some sort of incompatibility? We can exclude this change if necessary.

<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -563,7 +591,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.5.0</version>
<version>3.4.1</version>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto to the above.

<executions>
<execution>
<id>attach-javadocs</id>
Expand Down
Loading