Package lv.odylab.evemanage.application.exception

Examples of lv.odylab.evemanage.application.exception.EveApiException


    }

    @Test
    public void testDoPost_Exception() throws Exception {
        when(httpServletRequest.getParameter("userID")).thenReturn("1");
        doThrow(new EveApiException("Api error message")).when(eveUpdateService).updateApiKeysForUser(new Key<User>(User.class, 1));
        updateApiKeyTaskServlet.doPost(httpServletRequest, httpServletResponse);
    }
View Full Code Here


        characters.add(character2);

        when(apiKeyDao.getAll(userKey)).thenReturn(apiKeys);
        when(characterDao.getAll(userKey)).thenReturn(characters);
        doThrow(new ApiKeyShouldBeRemovedException("api key not valid")).when(eveApiDataService).populateApiKeyData(any(ApiKey.class));
        doThrow(new EveApiException("api error")).when(eveApiDataService).populateCharacterData(any(Character.class));
        eveUpdateService.updateApiKeysForUser(userKey);

        verify(eveApiDataService, times(1)).populateApiKeyData(any(ApiKey.class));
/*        verify(apiKeyDao, times(1)).putWithoutChecks(any(ApiKey.class));
        verify(eveApiDataService, times(2)).populateCharacterData(any(Character.class));
View Full Code Here

        accountCharacterDto.setCorporationID(3L);
        accountCharacterDtos.add(accountCharacterDto);

        when(securityManager.encrypt("apiKeyString".getBytes())).thenReturn("encryptedApiKey".getBytes());
        when(eveApiGateway.getApiKeyCharacters("apiKeyString", 1L)).thenReturn(accountCharacterDtos);
        when(eveApiGateway.getAccountBalances("apiKeyString", 1L, 2L)).thenThrow(new EveApiException("errorCode"));
        eveApiDataService.populateApiKeyData(apiKey, "apiKeyString");

        assertEquals("LIMITED", apiKey.getKeyType());
    }
View Full Code Here

        } catch (ApiErrorException e) {
            logger.warn("Caught ApiErrorException", e.getMessage());
            if (e.shouldRemoveApiKey() || e.shouldPostponeApiKey()) {
                throw new ApiKeyShouldBeRemovedException(e.getMessage());
            } else {
                throw new EveApiException(e);
            }
        } catch (ApiParserException e) {
            logger.error("Caught ApiParserException", e);
            throw new EveApiException(e);
        } catch (ApiIoException e) {
            logger.error("Caught ApiIoException", e);
            throw new EveApiException(e);
        }
    }
View Full Code Here

                accountBalanceDtos.add(mapper.map(apiAccountBalanceRow, AccountBalanceDto.class));
            }
            return accountBalanceDtos;
        } catch (ApiErrorException e) {
            logger.warn("Caught ApiErrorException", e.getMessage());
            throw new EveApiException(e);
        } catch (ApiParserException e) {
            logger.error("Caught ApiParserException", e);
            throw new EveApiException(e);
        } catch (ApiIoException e) {
            logger.error("Caught ApiIoException", e);
            throw new EveApiException(e);
        }
    }
View Full Code Here

            ApiCharacterSheetResponse apiResponse = facade.getCharacterSheet(apiKeyString, apiKeyUserID, characterID);
            ApiCharacterSheetResult apiCharacterSheetResult = apiResponse.getResult();
            return mapper.map(apiCharacterSheetResult, CharacterSheetDto.class);
        } catch (ApiErrorException e) {
            logger.warn("Caught ApiErrorException", e.getMessage());
            throw new EveApiException(e);
        } catch (ApiParserException e) {
            logger.error("Caught ApiParserException", e);
            throw new EveApiException(e);
        } catch (ApiIoException e) {
            logger.error("Caught ApiIoException", e);
            throw new EveApiException(e);
        }
    }
View Full Code Here

                industryJobDtos.add(mapper.map(apiIndustryJobRow, IndustryJobDto.class));
            }
            return industryJobDtos;
        } catch (ApiErrorException e) {
            logger.warn("Caught ApiErrorException", e.getMessage());
            throw new EveApiException(e);
        } catch (ApiParserException e) {
            logger.error("Caught ApiParserException", e);
            throw new EveApiException(e);
        } catch (ApiIoException e) {
            logger.error("Caught ApiIoException", e);
            throw new EveApiException(e);
        }
    }
View Full Code Here

            ApiCorporationSheetResponse response = facade.getCorporationSheet(corporationID);
            ApiCorporationSheetResult apiCorporationSheetResult = response.getResult();
            return mapper.map(apiCorporationSheetResult, CorporationSheetDto.class);
        } catch (ApiErrorException e) {
            logger.warn("Caught ApiErrorException", e.getMessage());
            throw new EveApiException(e);
        } catch (ApiParserException e) {
            logger.error("Caught ApiParserException", e);
            throw new EveApiException(e);
        } catch (ApiIoException e) {
            logger.error("Caught ApiIoException", e);
            throw new EveApiException(e);
        }
    }
View Full Code Here

                industryJobDtos.add(mapper.map(apiIndustryJobRow, IndustryJobDto.class));
            }
            return industryJobDtos;
        } catch (ApiErrorException e) {
            logger.warn("Caught ApiErrorException", e.getMessage());
            throw new EveApiException(e);
        } catch (ApiParserException e) {
            logger.error("Caught ApiParserException", e);
            throw new EveApiException(e);
        } catch (ApiIoException e) {
            logger.error("Caught ApiIoException", e);
            throw new EveApiException(e);
        }
    }
View Full Code Here

        try {
            apiKey = apiKeyDao.get(apiKeyKey);
        } catch (NotFoundException e) {
            logger.error("Caught NotFoundException", e);
            logger.error("Api key was not found in datastore despite character having reference to it, this is inconsistency, character: {} ({})", character.getName(), character.getCharacterID());
            throw new EveApiException("Character has invalid api key");
        }

        CharacterSheetDto characterSheetDto = eveApiGateway.getCharacterSheet(decodeApiKeyString(apiKey.getEncodedApiKeyString()), apiKey.getApiKeyUserID(), character.getCharacterID());
        CorporationSheetDto corporationSheetDto = eveApiGateway.getCorporationSheet(characterSheetDto.getCorporationID());
        character.setName(characterSheetDto.getName());
View Full Code Here

TOP

Related Classes of lv.odylab.evemanage.application.exception.EveApiException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.