@Override public boolean needsPostProcessing() { throw new NotAuthorizedException("User has not yet logged in"); } }
@Test public void serializes() { NotAuthorizedException instance = new NotAuthorizedException(message); NotAuthorizedException cloned = (NotAuthorizedException) SerializationUtils.clone(instance); assertThat(cloned).hasMessage(message); }
@Test public void serializesWithThrowable() { Throwable cause = new Exception(causeMessage); NotAuthorizedException instance = new NotAuthorizedException(message, cause); NotAuthorizedException cloned = (NotAuthorizedException) SerializationUtils.clone(instance); assertThat(cloned).hasMessage(message); assertThat(cloned).hasCause(cause); }
@Test public void oldSecurityShouldFailIfNotAuthorized() throws Exception { when(this.securityService.isClientSecurityRequired()).thenReturn(true); when(this.securityService.isIntegratedSecurity()).thenReturn(false); doThrow(new NotAuthorizedException("")).when(this.authzRequest) .destroyAuthorize(eq(REGION_NAME), eq(KEY), eq(CALLBACK_ARG)); this.destroy.cmdExecute(this.message, this.serverConnection, this.securityService, 0); verify(this.authzRequest).destroyAuthorize(eq(REGION_NAME), eq(KEY), eq(CALLBACK_ARG)); verify(this.errorResponseMessage).send(eq(this.serverConnection)); }
@Test public void oldSecurityShouldFailIfNotAuthorized() throws Exception { when(this.securityService.isClientSecurityRequired()).thenReturn(true); when(this.securityService.isIntegratedSecurity()).thenReturn(false); doThrow(new NotAuthorizedException("")).when(this.authzRequest).getAuthorize(eq(REGION_NAME), eq(KEY), eq(CALLBACK_ARG)); this.get70.cmdExecute(this.message, this.serverConnection, this.securityService, 0); verify(this.authzRequest).getAuthorize(eq(REGION_NAME), eq(KEY), eq(CALLBACK_ARG)); verify(this.errorResponseMessage).send(eq(this.serverConnection)); }
@Test public void oldSecurityShouldFailIfNotAuthorized() throws Exception { when(this.securityService.isClientSecurityRequired()).thenReturn(true); when(this.securityService.isIntegratedSecurity()).thenReturn(false); doThrow(new NotAuthorizedException("")).when(this.authzRequest).getAuthorize(eq(REGION_NAME), eq(KEY), any()); this.unregisterInterest.cmdExecute(this.message, this.serverConnection, this.securityService, 0); verify(this.authzRequest).unregisterInterestAuthorize(eq(REGION_NAME), eq(KEY), anyInt()); verify(this.replyMessage).send(eq(this.serverConnection)); }
@Test public void oldSecurityShouldFailIfNotAuthorized() throws Exception { when(this.securityService.isClientSecurityRequired()).thenReturn(true); when(this.securityService.isIntegratedSecurity()).thenReturn(false); doThrow(new NotAuthorizedException("")).when(this.authzRequest) .containsKeyAuthorize(eq(REGION_NAME), eq(KEY)); this.containsKey66.cmdExecute(this.message, this.serverConnection, this.securityService, 0); verify(this.authzRequest).containsKeyAuthorize(eq(REGION_NAME), eq(KEY)); verify(this.errorResponseMessage).send(eq(this.serverConnection)); }
@Test public void integratedSecurityShouldFailIfNotAuthorized() throws Exception { when(this.securityService.isClientSecurityRequired()).thenReturn(true); when(this.securityService.isIntegratedSecurity()).thenReturn(true); doThrow(new NotAuthorizedException("")).when(this.securityService).authorize(Resource.DATA, Operation.WRITE, REGION_NAME, KEY); this.destroy.cmdExecute(this.message, this.serverConnection, this.securityService, 0); verify(this.errorResponseMessage).send(eq(this.serverConnection)); }
@Test public void integratedSecurityShouldFailIfNotAuthorized() throws Exception { when(this.securityService.isClientSecurityRequired()).thenReturn(true); when(this.securityService.isIntegratedSecurity()).thenReturn(true); doThrow(new NotAuthorizedException("")).when(this.securityService).authorize(Resource.DATA, Operation.READ, REGION_NAME, KEY); this.unregisterInterest.cmdExecute(this.message, this.serverConnection, this.securityService, 0); verify(this.securityService).authorize(Resource.DATA, Operation.READ, REGION_NAME, KEY); verify(this.errorResponseMessage).send(eq(this.serverConnection)); }
@Test public void integratedSecurityShouldFailIfNotAuthorized() throws Exception { when(this.securityService.isClientSecurityRequired()).thenReturn(true); when(this.securityService.isIntegratedSecurity()).thenReturn(true); doThrow(new NotAuthorizedException("")).when(this.securityService).authorize(Resource.DATA, Operation.MANAGE); this.createRegion.cmdExecute(this.message, this.serverConnection, this.securityService, 0); verify(this.securityService).authorize(Resource.DATA, Operation.MANAGE); verify(this.errorResponseMessage).send(eq(this.serverConnection)); }
@Test public void integratedSecurityShouldFailIfNotAuthorized() throws Exception { when(this.securityService.isClientSecurityRequired()).thenReturn(true); when(this.securityService.isIntegratedSecurity()).thenReturn(true); doThrow(new NotAuthorizedException("")).when(this.securityService).authorize(Resource.DATA, Operation.WRITE, REGION_NAME, KEY); this.destroy65.cmdExecute(this.message, this.serverConnection, this.securityService, 0); verify(this.securityService).authorize(Resource.DATA, Operation.WRITE, REGION_NAME, KEY); verify(this.errorResponseMessage).send(eq(this.serverConnection)); }
@Test public void serializesWithNonSerializablePrincipal() { NotAuthorizedException instance = new NotAuthorizedException(message, nonSerializablePrincipal); assertThat(instance.getPrincipal()).isNotNull(); NotAuthorizedException cloned = (NotAuthorizedException) SerializationUtils.clone(instance); assertThat(cloned).hasMessage(message); assertThat(cloned.getPrincipal()).isNull(); }
@Test public void integratedSecurityShouldThrowIfNotAuthorized() throws Exception { when(this.securityService.isClientSecurityRequired()).thenReturn(true); when(this.securityService.isIntegratedSecurity()).thenReturn(true); doThrow(new NotAuthorizedException("")).when(this.securityService).authorize(Resource.DATA, Operation.READ, REGION_NAME, KEY); this.registerInterest.cmdExecute(this.message, this.serverConnection, this.securityService, 0); verify(this.securityService).authorize(Resource.DATA, Operation.READ, REGION_NAME, KEY); verify(this.chunkedResponseMessage).sendChunk(this.serverConnection); }
@Test public void integratedSecurityShouldFailIfNotAuthorized() throws Exception { when(this.securityService.isClientSecurityRequired()).thenReturn(true); when(this.securityService.isIntegratedSecurity()).thenReturn(true); doThrow(new NotAuthorizedException("")).when(this.securityService).authorize(Resource.DATA, Operation.WRITE, REGION_NAME, KEY); this.put65.cmdExecute(this.message, this.serverConnection, this.securityService, 0); verify(this.securityService).authorize(Resource.DATA, Operation.WRITE, REGION_NAME, KEY); verify(this.errorResponseMessage).send(this.serverConnection); }
@Test public void integratedSecurityShouldThrowIfNotAuthorized() throws Exception { when(this.securityService.isClientSecurityRequired()).thenReturn(true); when(this.securityService.isIntegratedSecurity()).thenReturn(true); doThrow(new NotAuthorizedException("")).when(this.securityService).authorize(Resource.DATA, Operation.READ, REGION_NAME); this.registerInterestList.cmdExecute(this.message, this.serverConnection, this.securityService, 0); verify(this.securityService).authorize(Resource.DATA, Operation.READ, REGION_NAME); verify(this.chunkedResponseMessage).sendChunk(this.serverConnection); }
@Test public void integratedSecurityShouldThrowIfNotAuthorized() throws Exception { when(this.securityService.isClientSecurityRequired()).thenReturn(true); when(this.securityService.isIntegratedSecurity()).thenReturn(true); doThrow(new NotAuthorizedException("")).when(this.securityService).authorize(Resource.DATA, Operation.WRITE, REGION_NAME, KEY); this.put.cmdExecute(this.message, this.serverConnection, this.securityService, 0); verify(this.securityService).authorize(Resource.DATA, Operation.WRITE, REGION_NAME, KEY); verify(this.errorResponseMessage).send(this.serverConnection); }
@Test public void integratedSecurityShouldThrowIfNotAuthorized() throws Exception { when(this.securityService.isClientSecurityRequired()).thenReturn(true); when(this.securityService.isIntegratedSecurity()).thenReturn(true); doThrow(new NotAuthorizedException("")).when(this.securityService).authorize(Resource.DATA, Operation.READ, REGION_NAME); this.registerInterestList61.cmdExecute(this.message, this.serverConnection, this.securityService, 0); verify(this.securityService).authorize(Resource.DATA, Operation.READ, REGION_NAME); verify(this.chunkedResponseMessage).sendChunk(this.serverConnection); }
@Test public void integratedSecurityShouldThrowIfNotAuthorized() throws Exception { when(this.securityService.isClientSecurityRequired()).thenReturn(true); when(this.securityService.isIntegratedSecurity()).thenReturn(true); doThrow(new NotAuthorizedException("")).when(this.securityService).authorize(Resource.DATA, Operation.READ, REGION_NAME, KEY); this.registerInterest61.cmdExecute(this.message, this.serverConnection, this.securityService, 0); verify(this.securityService).authorize(Resource.DATA, Operation.READ, REGION_NAME, KEY); verify(this.chunkedResponseMessage).sendChunk(this.serverConnection); }
@Test public void integratedSecurityShouldThrowIfNotAuthorized() throws Exception { when(this.securityService.isClientSecurityRequired()).thenReturn(true); when(this.securityService.isIntegratedSecurity()).thenReturn(true); doThrow(new NotAuthorizedException("")).when(this.securityService).authorize(Resource.DATA, Operation.READ, REGION_NAME); this.registerInterestList66.cmdExecute(this.message, this.serverConnection, this.securityService, 0); verify(this.securityService).authorize(Resource.DATA, Operation.READ, REGION_NAME); verify(this.chunkedResponseMessage).sendChunk(this.serverConnection); }
@Test public void integratedSecurityShouldFailIfNotAuthorized() throws Exception { when(this.securityService.isClientSecurityRequired()).thenReturn(true); when(this.securityService.isIntegratedSecurity()).thenReturn(true); doThrow(new NotAuthorizedException("")).when(this.securityService).authorize(Resource.DATA, Operation.READ, REGION_NAME); this.keySet.cmdExecute(this.message, this.serverConnection, this.securityService, 0); verify(this.securityService).authorize(Resource.DATA, Operation.READ, REGION_NAME); verify(this.chunkedResponseMessage).sendChunk(this.serverConnection); }