Skip to content

Commit

Permalink
GEODE-3200 Remove unused authzrequest (apache#2311)
Browse files Browse the repository at this point in the history
  • Loading branch information
moleske authored and jake-at-work committed Aug 31, 2018
1 parent 00f7603 commit fad877e
Show file tree
Hide file tree
Showing 13 changed files with 198 additions and 324 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ void handleTermination(boolean timedOut) {

private void setFakeRequest() {
testMessage = new TestMessage();
setRequestMsg(testMessage);
setRequestMessage(testMessage);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protected void doOneMessage() {
this.doHandshake = false;
} else {
this.resetTransientData();
doNormalMsg();
doNormalMessage();
}
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@ public void cmdExecute(final Message clientMessage, final ServerConnection serve
serverConnection.getSocketString());
}

if (!ServerConnection.allowInternalMessagesWithoutCredentials) {
serverConnection.getAuthzRequest();
}

int noOfParts = clientMessage.getNumberOfParts();

EnumInfo enumInfo = (EnumInfo) clientMessage.getPart(0).getObject();
int enumId = clientMessage.getPart(1).getInt();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@ public void cmdExecute(final Message clientMessage, final ServerConnection serve
serverConnection.getSocketString());
}

if (!ServerConnection.allowInternalMessagesWithoutCredentials) {
serverConnection.getAuthzRequest();
}

int noOfParts = clientMessage.getNumberOfParts();

PdxType type = (PdxType) clientMessage.getPart(0).getObject();
int typeId = clientMessage.getPart(1).getInt();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ public void cmdExecute(final Message clientMessage, final ServerConnection serve
final SecurityService securityService, long start) throws IOException {
serverConnection.setAsTrue(REQUIRES_RESPONSE);

if (!ServerConnection.allowInternalMessagesWithoutCredentials) {
serverConnection.getAuthzRequest();
}

String functionId = clientMessage.getPart(0).getString();
if (functionId == null) {
String message =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ public void cmdExecute(final Message clientMessage, final ServerConnection serve
serverConnection.getSocketString());
}

if (!ServerConnection.allowInternalMessagesWithoutCredentials) {
serverConnection.getAuthzRequest();
}

int enumId = clientMessage.getPart(0).getInt();

EnumInfo result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ public void cmdExecute(final Message clientMessage, final ServerConnection serve
serverConnection.getSocketString());
}

if (!ServerConnection.allowInternalMessagesWithoutCredentials) {
serverConnection.getAuthzRequest();
}

EnumInfo enumInfo = (EnumInfo) clientMessage.getPart(0).getObject();

int enumId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ public void cmdExecute(final Message clientMessage, final ServerConnection serve
serverConnection.getSocketString());
}

if (!ServerConnection.allowInternalMessagesWithoutCredentials) {
serverConnection.getAuthzRequest();
}

Map<Integer, EnumInfo> enums;
try {
InternalCache cache = serverConnection.getCache();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ public void cmdExecute(final Message clientMessage, final ServerConnection serve
serverConnection.getSocketString());
}

if (!ServerConnection.allowInternalMessagesWithoutCredentials) {
serverConnection.getAuthzRequest();
}

Map<Integer, PdxType> types;
try {
InternalCache cache = serverConnection.getCache();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ public void cmdExecute(final Message clientMessage, final ServerConnection serve
serverConnection.getSocketString());
}

if (!ServerConnection.allowInternalMessagesWithoutCredentials) {
serverConnection.getAuthzRequest();
}

int noOfParts = clientMessage.getNumberOfParts();
// Assert parts
Assert.assertTrue((noOfParts - 1) % 3 == 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import static org.apache.geode.internal.i18n.LocalizedStrings.HandShake_NO_SECURITY_CREDENTIALS_ARE_PROVIDED;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyLong;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

Expand Down Expand Up @@ -58,7 +58,7 @@ public class ServerConnectionTest {
*/
@Rule
public final RestoreLocaleRule restoreLocale =
new RestoreLocaleRule(Locale.ENGLISH, l -> StringId.setLocale(l));
new RestoreLocaleRule(Locale.ENGLISH, StringId::setLocale);

@Mock
private Message requestMsg;
Expand All @@ -69,27 +69,22 @@ public class ServerConnectionTest {
@InjectMocks
private ServerConnection serverConnection;

private AcceptorImpl acceptor;
private Socket socket;
private ServerSideHandshake handshake;
private InternalCache cache;
private SecurityService securityService;
private CacheServerStats stats;

@Before
public void setUp() throws IOException {
acceptor = mock(AcceptorImpl.class);
AcceptorImpl acceptor = mock(AcceptorImpl.class);

InetAddress inetAddress = mock(InetAddress.class);
when(inetAddress.getHostAddress()).thenReturn("localhost");

socket = mock(Socket.class);
Socket socket = mock(Socket.class);
when(socket.getInetAddress()).thenReturn(inetAddress);

cache = mock(InternalCache.class);
securityService = mock(SecurityService.class);
InternalCache cache = mock(InternalCache.class);
SecurityService securityService = mock(SecurityService.class);

stats = mock(CacheServerStats.class);
CacheServerStats stats = mock(CacheServerStats.class);

handshake = mock(ServerSideHandshake.class);
when(handshake.getEncryptor()).thenReturn(mock(Encryptor.class));
Expand Down Expand Up @@ -128,7 +123,7 @@ public void pre65NonSecureShouldReturnUserAuthId() {
public void post65SecureShouldUseUniqueIdFromMessage() {
long uniqueIdFromMessage = 23456L;
when(handshake.getVersion()).thenReturn(Version.GFE_82);
serverConnection.setRequestMsg(requestMsg);
serverConnection.setRequestMessage(requestMsg);

assertThat(serverConnection.getRequestMessage()).isSameAs(requestMsg);
when(requestMsg.isSecureMode()).thenReturn(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ public void cmdExecute(final Message clientMessage, final ServerConnection serve
serverConnection.setAsTrue(REQUIRES_RESPONSE);
serverConnection.setAsTrue(REQUIRES_CHUNKED_RESPONSE);

if (!ServerConnection.allowInternalMessagesWithoutCredentials) {
serverConnection.getAuthzRequest();
}

int op = clientMessage.getPart(0).getInt();

if (op < 1) {
Expand Down

0 comments on commit fad877e

Please sign in to comment.