Skip to content

Commit

Permalink
Rename tests that use shared system resources to IT tests to match
Browse files Browse the repository at this point in the history
failsafe plugin expectations.
Disable forked execution in modules that have tests relying on specific
port.
  • Loading branch information
MishaDemianenko committed Jun 15, 2017
1 parent deb99d1 commit 5824d0f
Show file tree
Hide file tree
Showing 51 changed files with 126 additions and 74 deletions.
11 changes: 11 additions & 0 deletions community/neo4j-harness/pom.xml
Expand Up @@ -54,6 +54,17 @@
</license>
</licenses>

<build>
<plugins>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<forkCount>1</forkCount>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>

<dependency>
Expand Down
Expand Up @@ -41,7 +41,7 @@
import static org.neo4j.harness.TestServerBuilders.newInProcessBuilder;
import static org.neo4j.test.server.HTTP.RawPayload.quotedJson;

public class FixturesTest
public class FixturesTestIT
{
@Rule
public TestDirectory testDir = TestDirectory.testDirectory();
Expand Down
Expand Up @@ -71,7 +71,7 @@
import static org.neo4j.harness.TestServerBuilders.newInProcessBuilder;
import static org.neo4j.helpers.collection.MapUtil.stringMap;

public class InProcessBuilderTest
public class InProcessBuilderTestIT
{
@Rule
public TestDirectory testDir = TestDirectory.testDirectory();
Expand Down
Expand Up @@ -45,7 +45,7 @@
import static org.neo4j.server.ServerTestUtils.getSharedTestTemporaryFolder;
import static org.neo4j.test.server.HTTP.RawPayload.quotedJson;

public class JUnitRuleTest
public class JUnitRuleTestIT
{
@Rule
public TestDirectory testDirectory = TestDirectory.testDirectory();
Expand Down
Expand Up @@ -33,7 +33,7 @@
import static org.junit.Assert.assertEquals;
import static org.neo4j.test.server.HTTP.RawPayload.quotedJson;

public class JavaAggregationFunctionsTest
public class JavaAggregationFunctionsTestIT
{
@Rule
public TestDirectory testDir = TestDirectory.testDirectory();
Expand Down
Expand Up @@ -35,7 +35,7 @@
import static org.junit.Assert.assertThat;
import static org.neo4j.test.server.HTTP.RawPayload.quotedJson;

public class JavaFunctionsTest
public class JavaFunctionsTestIT
{
@Rule
public TestDirectory testDir = TestDirectory.testDirectory();
Expand Down
11 changes: 11 additions & 0 deletions community/server-plugin-test/pom.xml
Expand Up @@ -50,6 +50,17 @@ the relevant Commercial Agreement.
</license>
</licenses>

<build>
<plugins>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<forkCount>1</forkCount>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.neo4j.app</groupId>
Expand Down
Expand Up @@ -50,7 +50,7 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

public class CloneSubgraphPluginTest extends ExclusiveServerTestBase
public class CloneSubgraphPluginTestIT extends ExclusiveServerTestBase
{
private static final RelationshipType KNOWS = RelationshipType.withName( "knows" );
private static final RelationshipType WORKED_FOR = RelationshipType.withName( "worked_for" );
Expand Down
Expand Up @@ -40,7 +40,7 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;

public class ExtensionListingFunctionalTest extends SharedServerTestBase
public class ExtensionListingFunctionalTestIT extends SharedServerTestBase
{
private static FunctionalTestHelper functionalTestHelper;

Expand Down
Expand Up @@ -51,7 +51,7 @@
import static org.junit.Assert.assertThat;

@SuppressWarnings( "unchecked" )
public class PluginFunctionalTest extends SharedServerTestBase
public class PluginFunctionalTestIT extends SharedServerTestBase
{
private static FunctionalTestHelper functionalTestHelper;

Expand Down
Expand Up @@ -30,11 +30,8 @@
import java.util.Map;
import java.util.concurrent.TimeUnit;

import org.neo4j.bolt.BoltKernelExtension;
import org.neo4j.graphdb.config.Setting;
import org.neo4j.kernel.configuration.ssl.SslPolicyConfig;
import org.neo4j.server.configuration.ConfigLoader;
import org.neo4j.server.configuration.ServerSettings;
import org.neo4j.test.server.ExclusiveServerTestBase;

import static org.hamcrest.Matchers.equalTo;
Expand All @@ -48,7 +45,7 @@
import static org.neo4j.helpers.collection.MapUtil.stringMap;
import static org.neo4j.test.assertion.Assert.assertEventually;

public abstract class BaseBootstrapperTest extends ExclusiveServerTestBase
public abstract class BaseBootstrapperTestIT extends ExclusiveServerTestBase
{
@Rule
public TemporaryFolder tempDir = new TemporaryFolder();
Expand Down
Expand Up @@ -19,7 +19,7 @@
*/
package org.neo4j.server;

public class CommunityBootstrapperTest extends BaseBootstrapperTest
public class CommunityBootstrapperTestIT extends BaseBootstrapperTestIT
{
@Override
protected ServerBootstrapper newBootstrapper()
Expand Down
Expand Up @@ -24,7 +24,7 @@
import org.neo4j.graphdb.factory.GraphDatabaseSettings;
import org.neo4j.server.helpers.CommunityServerBuilder;

public class NeoServerRestartTestCommunity extends NeoServerRestartTest
public class NeoServerRestartTestCommunityIT extends NeoServerRestartTestIT
{
protected NeoServer getNeoServer( String customPageSwapperName ) throws IOException
{
Expand Down
Expand Up @@ -34,7 +34,7 @@

import static org.junit.Assert.fail;

public abstract class NeoServerRestartTest extends ExclusiveServerTestBase
public abstract class NeoServerRestartTestIT extends ExclusiveServerTestBase
{
public static final String CUSTOM_SWAPPER = "CustomSwapper";
private static Semaphore semaphore;
Expand Down
Expand Up @@ -19,23 +19,23 @@
*/
package org.neo4j.server;

import java.io.IOException;
import java.net.URI;
import javax.ws.rs.core.MediaType;

import com.sun.jersey.api.client.Client;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;

import java.io.IOException;
import java.net.URI;
import javax.ws.rs.core.MediaType;

import org.neo4j.server.helpers.ServerHelper;
import org.neo4j.server.rest.JaxRsResponse;
import org.neo4j.server.rest.RestRequest;
import org.neo4j.test.server.ExclusiveServerTestBase;

import static org.junit.Assert.assertEquals;

public class RedirectToBrowserTest extends ExclusiveServerTestBase
public class RedirectToBrowserTestIT extends ExclusiveServerTestBase
{
private static NeoServer server;

Expand Down
Expand Up @@ -19,12 +19,12 @@
*/
package org.neo4j.server.rest;

import java.util.Map;
import javax.ws.rs.core.MediaType;

import com.sun.jersey.api.client.ClientResponse.Status;
import org.junit.Test;

import java.util.Map;
import javax.ws.rs.core.MediaType;

import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.RelationshipType;
import org.neo4j.graphdb.Transaction;
Expand All @@ -36,7 +36,7 @@

import static org.junit.Assert.assertTrue;

public class CreateRelationshipTest extends AbstractRestFunctionalDocTestBase
public class CreateRelationshipTestIT extends AbstractRestFunctionalDocTestBase
{
@Test
@Graph( "Joe knows Sara" )
Expand Down
Expand Up @@ -49,7 +49,7 @@
import static org.neo4j.test.server.HTTP.GET;
import static org.neo4j.test.server.HTTP.POST;

public class TransactionTest extends AbstractRestFunctionalTestBase
public class TransactionTestIT extends AbstractRestFunctionalTestBase
{
@Test
@Documented( "Begin a transaction\n" +
Expand Down
Expand Up @@ -38,7 +38,7 @@
import static org.neo4j.server.rest.transactional.integration.TransactionMatchers.rowContainsMetaRelsAtIndex;
import static org.neo4j.test.server.HTTP.RawPayload.quotedJson;

public class RowFormatMetaFieldTest extends AbstractRestFunctionalTestBase
public class RowFormatMetaFieldTestIT extends AbstractRestFunctionalTestBase
{
private final HTTP.Builder http = HTTP.withBaseUri( "http://localhost:7474" );

Expand Down
Expand Up @@ -32,7 +32,7 @@

import static org.neo4j.test.rule.SuppressOutput.suppressAll;

public class TestJetty9WebServer extends ExclusiveServerTestBase
public class TestJetty9WebServerIT extends ExclusiveServerTestBase
{
@Rule
public SuppressOutput suppressOutput = suppressAll();
Expand Down
Expand Up @@ -29,7 +29,7 @@

import static org.junit.Assert.assertEquals;

public class WebServerDirectoryListingTest extends ExclusiveServerTestBase
public class WebServerDirectoryListingTestIT extends ExclusiveServerTestBase
{
private CommunityNeoServer server;

Expand Down
@@ -1 +1 @@
org.neo4j.server.NeoServerRestartTest$CustomSwapper
org.neo4j.server.NeoServerRestartTestIT$CustomSwapper
6 changes: 6 additions & 0 deletions community/shell/pom.xml
Expand Up @@ -59,6 +59,12 @@ the relevant Commercial Agreement.

<build>
<plugins>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<forkCount>1</forkCount>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
Expand Down
6 changes: 6 additions & 0 deletions enterprise/backup/pom.xml
Expand Up @@ -49,6 +49,12 @@

<build>
<plugins>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<forkCount>1</forkCount>
</configuration>
</plugin>
<plugin>
<groupId>org.neo4j.build.plugins</groupId>
<artifactId>clirr-maven-plugin</artifactId>
Expand Down
Expand Up @@ -86,7 +86,7 @@
import static org.neo4j.kernel.impl.MyRelTypes.TEST;

@RunWith( Parameterized.class )
public class TestBackup
public class BackupIT
{
private final TestDirectory testDir = TestDirectory.testDirectory();
private final DefaultFileSystemRule fileSystemRule = new DefaultFileSystemRule();
Expand Down
Expand Up @@ -43,7 +43,7 @@

import static org.junit.Assert.assertEquals;

public class IncrementalBackupTest
public class IncrementalBackupIT
{
@Rule
public TestName testName = new TestName();
Expand Down
Expand Up @@ -41,6 +41,7 @@ public class TestConfiguration
private static final File SOURCE_DIR = new File( "target/db" );
private static final String BACKUP_DIR = "target/full-backup";
private static final String HOST_ADDRESS = "127.0.0.1";
private static final int PORT = 6365;

@Before
public void before() throws Exception
Expand All @@ -52,8 +53,9 @@ public void before() throws Exception
@Test
public void testOnByDefault() throws Exception
{
GraphDatabaseService db = new TestGraphDatabaseFactory().newEmbeddedDatabase( SOURCE_DIR );
OnlineBackup.from( HOST_ADDRESS ).full( BACKUP_DIR );
GraphDatabaseService db = new TestGraphDatabaseFactory().newEmbeddedDatabaseBuilder( SOURCE_DIR )
.setConfig( OnlineBackupSettings.online_backup_server, "localhost:" + PORT ).newGraphDatabase();
OnlineBackup.from( HOST_ADDRESS, PORT ).full( BACKUP_DIR );
db.shutdown();
}

Expand All @@ -62,10 +64,11 @@ public void testOffByConfig() throws Exception
{
GraphDatabaseService db = new TestGraphDatabaseFactory().newEmbeddedDatabaseBuilder( SOURCE_DIR )
.setConfig( OnlineBackupSettings.online_backup_enabled, Settings.FALSE )
.setConfig( OnlineBackupSettings.online_backup_server, "localhost:" + PORT )
.newGraphDatabase();
try
{
OnlineBackup.from( HOST_ADDRESS ).full( BACKUP_DIR );
OnlineBackup.from( HOST_ADDRESS, PORT ).full( BACKUP_DIR );
fail( "Shouldn't be possible" );
}
catch ( Exception e )
Expand All @@ -79,9 +82,10 @@ public void testEnableDefaultsInConfig() throws Exception
{
GraphDatabaseService db = new TestGraphDatabaseFactory().newEmbeddedDatabaseBuilder( SOURCE_DIR )
.setConfig( OnlineBackupSettings.online_backup_enabled, Settings.TRUE )
.setConfig( OnlineBackupSettings.online_backup_server, "localhost:" + PORT )
.newGraphDatabase();

OnlineBackup.from( HOST_ADDRESS ).full( BACKUP_DIR );
OnlineBackup.from( HOST_ADDRESS, PORT ).full( BACKUP_DIR );
db.shutdown();
}

Expand All @@ -95,7 +99,7 @@ public void testEnableCustomPortInConfig() throws Exception
.newGraphDatabase();
try
{
OnlineBackup.from( HOST_ADDRESS ).full( BACKUP_DIR );
OnlineBackup.from( HOST_ADDRESS, 12346 ).full( BACKUP_DIR );
fail( "Shouldn't be possible" );
}
catch ( Exception e )
Expand Down
Expand Up @@ -31,7 +31,7 @@ public class StoreFilesWithRealFileSystemTest extends StoreFilesTest
@Override
protected void createRules()
{
testDirectory = TestDirectory.testDirectory( StoreFilesTest.class );
testDirectory = TestDirectory.testDirectory( StoreFilesWithRealFileSystemTest.class );
DefaultFileSystemRule defaultFileSystemRule = new DefaultFileSystemRule();
fileSystemRule = defaultFileSystemRule::get;
hiddenFileSystemRule = new EphemeralFileSystemRule();
Expand Down
Expand Up @@ -66,7 +66,7 @@
import static org.neo4j.kernel.impl.ha.ClusterManager.masterAvailable;
import static org.neo4j.kernel.impl.ha.ClusterManager.masterSeesSlavesAsAvailable;

public class TestPullUpdates
public class TestPullUpdatesIT
{
private static final int PULL_INTERVAL = 100;
private static final int SHELL_PORT = 6370;
Expand Down
Expand Up @@ -37,7 +37,7 @@
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

public class TestBasicHaOperations
public class TestBasicHaOperationsIT
{
@ClassRule
public static LoggerRule logger = new LoggerRule( Level.OFF );
Expand Down
6 changes: 6 additions & 0 deletions enterprise/kernel/pom.xml
Expand Up @@ -47,6 +47,12 @@

<build>
<plugins>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<forkCount>1</forkCount>
</configuration>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
Expand Down

0 comments on commit 5824d0f

Please sign in to comment.