Skip to content

Commit

Permalink
Remove abstract method
Browse files Browse the repository at this point in the history
All implementations were equal, so the method was pulled to the superclass.
  • Loading branch information
Mats-SX committed Oct 26, 2016
1 parent 7610ed4 commit 544a8cf
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 46 deletions.
Expand Up @@ -19,15 +19,13 @@
*/
package org.neo4j.server.security.enterprise.auth;

import org.junit.Rule;
import org.junit.Test;

import java.util.Map;
import java.util.stream.Stream;

import org.neo4j.bolt.v1.transport.socket.client.TransportConnection;
import org.neo4j.kernel.api.exceptions.InvalidArgumentsException;
import org.neo4j.test.rule.concurrent.ThreadingRule;

import static java.lang.String.format;
import static org.hamcrest.MatcherAssert.assertThat;
Expand All @@ -52,9 +50,6 @@ public abstract class AuthProceduresInteractionTestBase<S> extends ProcedureInte
{
private static final String PWD_CHANGE = PASSWORD_CHANGE_REQUIRED.name().toLowerCase();

@Rule
public final ThreadingRule threading = new ThreadingRule();

//---------- General tests over all procedures -----------

@Test
Expand Down Expand Up @@ -998,10 +993,4 @@ public void shouldSetCorrectMultiRolePermissions() throws Exception
testFailCreateUser( schemaSubject, PERMISSION_DENIED );
assertEmpty( schemaSubject, "CALL dbms.security.changePassword( '321' )" );
}

@Override
protected ThreadingRule threading()
{
return threading;
}
}
Expand Up @@ -20,7 +20,6 @@
package org.neo4j.server.security.enterprise.auth;

import org.apache.commons.io.Charsets;
import org.junit.Rule;
import org.junit.Test;

import java.io.BufferedReader;
Expand All @@ -34,21 +33,18 @@
import org.neo4j.kernel.api.Statement;
import org.neo4j.kernel.impl.core.ThreadToStatementContextBridge;
import org.neo4j.test.DoubleLatch;
import org.neo4j.test.rule.concurrent.ThreadingRule;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.Matchers.lessThan;
import static org.junit.Assert.fail;
import static org.neo4j.graphdb.security.AuthorizationViolationException.PERMISSION_DENIED;
import static org.neo4j.server.security.enterprise.auth.plugin.api.PredefinedRoles.*;
import static org.neo4j.server.security.enterprise.auth.plugin.api.PredefinedRoles.ADMIN;
import static org.neo4j.server.security.enterprise.auth.plugin.api.PredefinedRoles.ARCHITECT;
import static org.neo4j.server.security.enterprise.auth.plugin.api.PredefinedRoles.PUBLISHER;
import static org.neo4j.server.security.enterprise.auth.plugin.api.PredefinedRoles.READER;

public abstract class AuthScenariosInteractionTestBase<S> extends ProcedureInteractionTestBase<S>
{
@Rule
public final ThreadingRule threading = new ThreadingRule();

//---------- User creation -----------

Expand Down Expand Up @@ -780,10 +776,4 @@ public void shouldNotTryToCreateTokensWhenReading()
assertSuccess( readSubject, "MATCH (n:MyNode) WHERE n.nonExistent = 'foo' RETURN toString(count(*)) AS c",
r -> assertKeyIs( r, "c", "1" ) );
}

@Override
protected ThreadingRule threading()
{
return threading;
}
}
Expand Up @@ -24,7 +24,6 @@
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.junit.Rule;
import org.junit.Test;

import java.time.OffsetDateTime;
Expand All @@ -42,7 +41,6 @@
import org.neo4j.server.security.enterprise.auth.plugin.api.PredefinedRoles;
import org.neo4j.test.Barrier;
import org.neo4j.test.DoubleLatch;
import org.neo4j.test.rule.concurrent.ThreadingRule;

import static java.lang.String.format;
import static java.time.format.DateTimeFormatter.ISO_OFFSET_DATE_TIME;
Expand All @@ -66,8 +64,6 @@

public abstract class BuiltInProceduresInteractionTestBase<S> extends ProcedureInteractionTestBase<S>
{
@Rule
public final ThreadingRule threading = new ThreadingRule();

/*
This surface is hidden in 3.1, to possibly be completely removed or reworked later
Expand Down Expand Up @@ -1111,10 +1107,4 @@ private Matcher<Map<String, Object>> hasMetaData( Map<String,Object> expected )
) );
}

@Override
protected ThreadingRule threading()
{
return threading;
}

}
Expand Up @@ -19,7 +19,6 @@
*/
package org.neo4j.server.security.enterprise.auth;

import org.junit.Rule;
import org.junit.Test;

import java.util.Arrays;
Expand All @@ -31,7 +30,6 @@
import org.neo4j.kernel.api.proc.UserFunctionSignature;
import org.neo4j.kernel.impl.proc.Procedures;
import org.neo4j.server.security.enterprise.configuration.SecuritySettings;
import org.neo4j.test.rule.concurrent.ThreadingRule;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsInAnyOrder;
Expand All @@ -41,14 +39,6 @@

public abstract class ConfiguredProceduresTestBase<S> extends ProcedureInteractionTestBase<S>
{
@Rule
public final ThreadingRule threading = new ThreadingRule();

@Override
protected ThreadingRule threading()
{
return threading;
}

@Override
public void setUp() throws Throwable
Expand Down
Expand Up @@ -23,6 +23,7 @@
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;

import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -114,7 +115,13 @@ String pwdReqErrMsg( String errMsg )
"writeSubject", "pwdSubject", "noneSubject", "neo4j" };
String[] initialRoles = { ADMIN, ARCHITECT, PUBLISHER, READER, EMPTY_ROLE };

protected abstract ThreadingRule threading();
@Rule
public final ThreadingRule threading = new ThreadingRule();

private ThreadingRule threading()
{
return threading;
}

EnterpriseUserManager userManager;

Expand Down

0 comments on commit 544a8cf

Please sign in to comment.