Skip to content

Commit

Permalink
Code: Updated eve-esi library to 4.9.0
Browse files Browse the repository at this point in the history
Merge main
  • Loading branch information
GoldenGnu committed Oct 6, 2024
2 parents 80dfd9c + fccba02 commit 2394cab
Show file tree
Hide file tree
Showing 13 changed files with 91 additions and 40 deletions.
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@
<environmentVariables>
<JANICE_API_KEY>${janice}</JANICE_API_KEY>
</environmentVariables>
<trimStackTrace>false</trimStackTrace>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -1226,7 +1227,7 @@
<dependency>
<groupId>net.troja.eve</groupId>
<artifactId>eve-esi</artifactId>
<version>4.8.1</version>
<version>4.9.0</version>
</dependency>
<dependency>
<groupId>uk.me.candle</groupId>
Expand Down
24 changes: 15 additions & 9 deletions src/main/java/net/nikr/eve/jeveasset/LibraryManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,39 +108,45 @@ public static synchronized Set<String> getLibFiles() {
files.add("logback-classic-1.2.11.jar");
files.add("super-csv-2.4.0.jar");
files.add("translations-3.1.1.jar");
files.add("swagger-annotations-1.6.5.jar");
files.add("annotations-13.0.jar");
files.add("hamcrest-core-1.3.jar");
files.add("eve-esi-4.8.1.jar");
files.add("okio-jvm-3.0.0.jar");
files.add("hamcrest-core-1.3.jar");
files.add("jaxb-api-2.3.1.jar");
files.add("sqlite-jdbc-3.36.0.3.jar");
files.add("okhttp-4.10.0.jar");
files.add("gson-fire-1.8.5.jar");
files.add("gson-2.9.0.jar");
files.add("logging-interceptor-4.10.0.jar");
files.add("org.apache.oltu.oauth2.common-1.0.1.jar");
files.add("org.apache.oltu.oauth2.client-1.0.1.jar");
files.add("json-20230227.jar");
files.add("commons-codec-1.15.jar");
files.add("commons-lang3-3.12.0.jar");
files.add("jna-platform-5.6.0.jar");
files.add("jna-5.6.0.jar");
files.add("jsr250-api-1.0.jar");
files.add("jsr305-3.0.2.jar");
files.add("flatlaf-3.4.1.jar");
files.add("kotlin-stdlib-jdk7-1.6.10.jar");
files.add("kotlin-stdlib-1.6.20.jar");
files.add("kotlin-stdlib-jdk8-1.6.10.jar");
files.add("kotlin-stdlib-common-1.6.21.jar");
files.add("EvalEx-2.7.jar");
files.add("picocli-4.6.2.jar");
//Native Mac GUI integration
files.add("jsvg-1.4.0.jar");
files.add("flatlaf-extras-3.4.1.jar");
//MP3
files.add("jlayer-1.0.2.jar");
//Eve-ESI
files.add("gson-2.9.1.jar");
files.add("jackson-core-2.14.0-rc2.jar");
files.add("org.apache.oltu.oauth2.common-1.0.2.jar");
files.add("jackson-databind-nullable-0.2.6.jar");
files.add("kotlin-stdlib-common-1.5.31.jar");
files.add("jackson-annotations-2.14.0-rc2.jar");
files.add("jsr311-api-1.1.1.jar");
files.add("eve-esi-4.9.0.jar");
files.add("json-20140107.jar");
files.add("commons-codec-1.9.jar");
files.add("org.apache.oltu.oauth2.client-1.0.2.jar");
files.add("javax.ws.rs-api-2.1.1.jar");
files.add("gson-2.9.1.jar");
files.add("jackson-databind-2.14.0-rc2.jar");
}
return files;
}
Expand Down
11 changes: 10 additions & 1 deletion src/main/java/net/nikr/eve/jeveasset/data/api/my/MyJournal.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,18 @@ public Tags getTags() {
return tags;
}

private double getAmountNotNull() {
Double amount = getAmount();
if (amount != null) {
return amount;
} else {
return 0.0;
}
}

@Override
public TagID getTagID() {
return new TagID(JournalTab.NAME, getRefID(), getAmount());
return new TagID(JournalTab.NAME, getRefID(), getAmountNotNull());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,19 @@ public enum RawJournalRefType {
MARKET_PROVIDER_TAX(149, "Market Provider Tax"),
ESS_ESCROW_TRANSFER(155, "ESS Escrow Transfer"),
MILESTONE_REWARD_PAYMENT(156, "Milestone Reward Payment"),
UNDER_CONSTRUCTION(166, "Under Construction"),
ALLIGNMENT_BASED_GATE_TOLL (168, "Allignment Based Gate Toll"),
PROJECT_PAYOUTS (170, "Project Payouts"),
INSURGENCY_CORRUPTION_CONTRIBUTION_REWARD (172, "Insurgency Corruption Contribution Reward"),
INSURGENCY_SUPPRESSION_CONTRIBUTION_REWARD (173, "Insurgency Suppression Contribution Reward"),
DAILY_GOAL_PAYOUTS (174, "Daily Goal Payouts"),
DAILY_GOAL_PAYOUTS_TAX (175, "Daily Goal Payouts Tax"),
COSMETIC_MARKET_COMPONENT_ITEM_PURCHASE (178, "Cosmetic Market Component Item Purchase"),
COSMETIC_MARKET_SKIN_SALE_BROKER_FEE (179, "Cosmetic Market Skin Sale Broker Fee"),
COSMETIC_MARKET_SKIN_PURCHASE (180, "Cosmetic Market Skin Purchase"),
COSMETIC_MARKET_SKIN_SALE (181, "Cosmetic Market Skin Sale"),
COSMETIC_MARKET_SKIN_SALE_TAX (182, "Cosmetic Market Skin Sale Tax"),
COSMETIC_MARKET_SKIN_TRANSACTION (183, "Cosmetic Market Skin Sale Transaction"),
MODIFY_ISK(10001, "Modify ISK"),
PRIMARY_MARKETPLACE_PURCHASE(10002, "Primary Marketplace Purchase"),
BATTLE_REWARD(10003, "Battle Reward"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
import net.nikr.eve.jeveasset.data.api.accounts.EsiOwner;
import net.nikr.eve.jeveasset.data.api.my.MyAsset;
import net.nikr.eve.jeveasset.data.sde.Item;
Expand All @@ -48,16 +49,16 @@ public EsiLocationsGetter(UpdateTask updateTask, EsiOwner owner) {
protected void update() throws ApiException {
Map<Long, MyAsset> iDs = getIDs(owner);
if (owner.isCorporation()) {
Map<List<Long>, List<CorporationAssetsNamesResponse>> responses = updateList(splitList(iDs.keySet(), LOCATIONS_BATCH_SIZE), DEFAULT_RETRIES, new ListHandler<List<Long>, List<CorporationAssetsNamesResponse>>() {
Map<Set<Long>, List<CorporationAssetsNamesResponse>> responses = updateList(splitSet(iDs.keySet(), LOCATIONS_BATCH_SIZE), DEFAULT_RETRIES, new ListHandler<Set<Long>, List<CorporationAssetsNamesResponse>>() {
@Override
public ApiResponse<List<CorporationAssetsNamesResponse>> get(List<Long> t) throws ApiException {
public ApiResponse<List<CorporationAssetsNamesResponse>> get(Set<Long> t) throws ApiException {
return getAssetsApiAuth().postCorporationsCorporationIdAssetsNamesWithHttpInfo((int) owner.getOwnerID(), t, DATASOURCE, null);
}
});

try {
Settings.lock("Ship/Container Names");
for (Map.Entry<List<Long>, List<CorporationAssetsNamesResponse>> entry : responses.entrySet()) {
for (Map.Entry<Set<Long>, List<CorporationAssetsNamesResponse>> entry : responses.entrySet()) {
for (CorporationAssetsNamesResponse response : entry.getValue()) {
final long itemID = response.getItemId();
final String eveName = response.getName();
Expand All @@ -76,15 +77,15 @@ public ApiResponse<List<CorporationAssetsNamesResponse>> get(List<Long> t) throw
Settings.unlock("Ship/Container Names");
}
} else {
Map<List<Long>, List<CharacterAssetsNamesResponse>> responses = updateList(splitList(iDs.keySet(), LOCATIONS_BATCH_SIZE), DEFAULT_RETRIES, new ListHandler<List<Long>, List<CharacterAssetsNamesResponse>>() {
Map<Set<Long>, List<CharacterAssetsNamesResponse>> responses = updateList(splitSet(iDs.keySet(), LOCATIONS_BATCH_SIZE), DEFAULT_RETRIES, new ListHandler<Set<Long>, List<CharacterAssetsNamesResponse>>() {
@Override
public ApiResponse<List<CharacterAssetsNamesResponse>> get(List<Long> t) throws ApiException {
public ApiResponse<List<CharacterAssetsNamesResponse>> get(Set<Long> t) throws ApiException {
return getAssetsApiAuth().postCharactersCharacterIdAssetsNamesWithHttpInfo((int) owner.getOwnerID(), t, DATASOURCE, null);
}
});
try {
Settings.lock("Ship/Container Names");
for (Map.Entry<List<Long>, List<CharacterAssetsNamesResponse>> entry : responses.entrySet()) {
for (Map.Entry<Set<Long>, List<CharacterAssetsNamesResponse>> entry : responses.entrySet()) {
for (CharacterAssetsNamesResponse response : entry.getValue()) {
final long itemID = response.getItemId();
final String eveName = response.getName();
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/net/nikr/eve/jeveasset/io/esi/EsiNameGetter.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ public EsiNameGetter(UpdateTask updateTask, List<OwnerType> ownerTypes) {
@Override
protected void update() throws ApiException {
Set<Integer> ids = getOwnerIDs(ownerTypes);
Map<List<Integer>, List<UniverseNamesResponse>> responses = updateList(splitList(ids, UNIVERSE_BATCH_SIZE), DEFAULT_RETRIES, new ListHandler<List<Integer>, List<UniverseNamesResponse>>() {
Map<Set<Integer>, List<UniverseNamesResponse>> responses = updateList(splitSet(ids, UNIVERSE_BATCH_SIZE), DEFAULT_RETRIES, new ListHandler<Set<Integer>, List<UniverseNamesResponse>>() {
@Override
public ApiResponse<List<UniverseNamesResponse>> get(List<Integer> t) throws ApiException {
public ApiResponse<List<UniverseNamesResponse>> get(Set<Integer> t) throws ApiException {
try {
return getUniverseApiOpen().postUniverseNamesWithHttpInfo(t, DATASOURCE);
} catch (ApiException ex) {
Expand All @@ -73,15 +73,15 @@ public ApiResponse<List<UniverseNamesResponse>> get(List<Integer> t) throws ApiE
});

Set<Integer> retries = new HashSet<>(ids);
for (Map.Entry<List<Integer>, List<UniverseNamesResponse>> entry : responses.entrySet()) {
for (Map.Entry<Set<Integer>, List<UniverseNamesResponse>> entry : responses.entrySet()) {
for (UniverseNamesResponse lookup : entry.getValue()) {
Settings.get().getOwners().put((long)lookup.getId(), lookup.getName());
}
retries.removeAll(entry.getKey());
}
Map<List<Integer>, List<UniverseNamesResponse>> retryResponses = updateList(splitList(retries, 1), DEFAULT_RETRIES, new ListHandler<List<Integer>, List<UniverseNamesResponse>>() {
Map<Set<Integer>, List<UniverseNamesResponse>> retryResponses = updateList(splitSet(retries, 1), DEFAULT_RETRIES, new ListHandler<Set<Integer>, List<UniverseNamesResponse>>() {
@Override
public ApiResponse<List<UniverseNamesResponse>> get(List<Integer> t) throws ApiException {
public ApiResponse<List<UniverseNamesResponse>> get(Set<Integer> t) throws ApiException {
try {
return getUniverseApiOpen().postUniverseNamesWithHttpInfo(t, DATASOURCE);
} catch (ApiException ex) {
Expand All @@ -95,7 +95,7 @@ public ApiResponse<List<UniverseNamesResponse>> get(List<Integer> t) throws ApiE
}
});
int count = 30;
for (Map.Entry<List<Integer>, List<UniverseNamesResponse>> entry : retryResponses.entrySet()) {
for (Map.Entry<Set<Integer>, List<UniverseNamesResponse>> entry : retryResponses.entrySet()) {
for (UniverseNamesResponse lookup : entry.getValue()) {
Settings.get().getOwners().put((long)lookup.getId(), lookup.getName());
Date date = new Date(System.currentTimeMillis() + (ONE_DAY * count));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
*/
package net.nikr.eve.jeveasset.io.esi;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import net.nikr.eve.jeveasset.data.api.accounts.EsiOwner;
Expand Down Expand Up @@ -81,7 +81,7 @@ protected void update() throws ApiException {
List<CharacterAffiliationResponse> affiliationResponse = update(DEFAULT_RETRIES, new EsiHandler<List<CharacterAffiliationResponse>>() {
@Override
public ApiResponse<List<CharacterAffiliationResponse>> get() throws ApiException {
return getCharacterApiOpen().postCharactersAffiliationWithHttpInfo(Collections.singletonList(characterID), DATASOURCE);
return getCharacterApiOpen().postCharactersAffiliationWithHttpInfo(Collections.singleton(characterID), DATASOURCE);
}
});
if (affiliationResponse.isEmpty()) {
Expand All @@ -91,7 +91,7 @@ public ApiResponse<List<CharacterAffiliationResponse>> get() throws ApiException
}
Integer corporationID = affiliationResponse.get(0).getCorporationId();
//IDs to Names
List<Integer> ids = new ArrayList<>();
Set<Integer> ids = new HashSet<>();
ids.add(characterID);
ids.add(corporationID);
List<UniverseNamesResponse> namesResponse = update(DEFAULT_RETRIES, new EsiHandler<List<UniverseNamesResponse>>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ public ApiResponse<List<MarketOrdersResponse>> get(Integer page) throws ApiExcep
input.getLocationToSystem().put(ordersResponse.getLocationId(), RawConverter.toLong(ordersResponse.getSystemId()));
}
//Get public structures
input.getStructureIDs().addAll(update(DEFAULT_RETRIES, new EsiHandler<List<Long>>() {
input.getStructureIDs().addAll(update(DEFAULT_RETRIES, new EsiHandler<Set<Long>>() {
@Override
public ApiResponse<List<Long>> get() throws ApiException {
public ApiResponse<Set<Long>> get() throws ApiException {
return getUniverseApiOpen().getUniverseStructuresWithHttpInfo(DATASOURCE, "market", null);
}
}));
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/net/nikr/eve/jeveasset/io/shared/AbstractGetter.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
Expand Down Expand Up @@ -332,6 +334,19 @@ private <T> List<List<T>> splitList(List<T> list, final int L) {
return parts;
}

protected final <T> List<Set<T>> splitSet(Collection<T> list, final int L) {
return splitSet(new ArrayList<>(list), L);
}

private <T> List<Set<T>> splitSet(List<T> list, final int L) {
List<Set<T>> parts = new ArrayList<>();
final int N = list.size();
for (int i = 0; i < N; i += L) {
parts.add(new HashSet<>(list.subList(i, Math.min(N, i + L))));
}
return parts;
}

protected final Map<Long, MyAsset> getIDs(OwnerType owner) {
Map<Long, MyAsset> itemMap = new HashMap<>();
ArrayList<MyAsset> assets;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,8 @@ public enum LocationFlag {
SPECIALIZEDASTEROIDHOLD("SpecializedAsteroidHold", 182),
MOBILEDEPOTHOLD("MobileDepot", 183),
CORPORATIONGOALDELIVERIES("CorpProjectsHangar", 184),
INFRASTRUCTUREHANGAR("ColonyResourcesHold", 185),
MOONMATERIALBAY("MoonMaterialBay", 186),
;

private final String value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ public void esiJournalGetterCorporation() {
@Test
public void esiLocationsGetterCharacterLocations() {
try {
ApiResponse<List<CharacterAssetsNamesResponse>> apiResponse = ASSETS_API.postCharactersCharacterIdAssetsNamesWithHttpInfo(1, Collections.singletonList(1L), DATASOURCE, null);
ApiResponse<List<CharacterAssetsNamesResponse>> apiResponse = ASSETS_API.postCharactersCharacterIdAssetsNamesWithHttpInfo(1, Collections.singleton(1L), DATASOURCE, null);
validate(apiResponse.getHeaders());
} catch (ApiException ex) {
validate(ex.getResponseHeaders());
Expand All @@ -458,7 +458,7 @@ public void esiLocationsGetterCharacterLocations() {
@Test
public void esiLocationsGetterCorporation() {
try {
ApiResponse<List<CorporationAssetsNamesResponse>> apiResponse = ASSETS_API.postCorporationsCorporationIdAssetsNamesWithHttpInfo(1, Collections.singletonList(1L), DATASOURCE, null);
ApiResponse<List<CorporationAssetsNamesResponse>> apiResponse = ASSETS_API.postCorporationsCorporationIdAssetsNamesWithHttpInfo(1, Collections.singleton(1L), DATASOURCE, null);
validate(apiResponse.getHeaders());
} catch (ApiException ex) {
validate(ex.getResponseHeaders());
Expand Down Expand Up @@ -578,7 +578,7 @@ public void esiMiningGetterMoons() {
@Test
public void esiNameGetter() {
try {
ApiResponse<List<UniverseNamesResponse>> apiResponse = UNIVERSE_API.postUniverseNamesWithHttpInfo(Collections.singletonList(1), DATASOURCE);
ApiResponse<List<UniverseNamesResponse>> apiResponse = UNIVERSE_API.postUniverseNamesWithHttpInfo(Collections.singleton(1), DATASOURCE);
validate(apiResponse.getHeaders());
} catch (ApiException ex) {
validate(ex.getResponseHeaders());
Expand All @@ -588,7 +588,7 @@ public void esiNameGetter() {
@Test
public void esiOwnerGetterCharacter() {
try {
ApiResponse<List<CharacterAffiliationResponse>> apiResponse = CHARACTER_API.postCharactersAffiliationWithHttpInfo(Collections.singletonList(1), DATASOURCE);
ApiResponse<List<CharacterAffiliationResponse>> apiResponse = CHARACTER_API.postCharactersAffiliationWithHttpInfo(Collections.singleton(1), DATASOURCE);
validate(apiResponse.getHeaders());
} catch (ApiException ex) {
validate(ex.getResponseHeaders());
Expand Down Expand Up @@ -658,7 +658,7 @@ public void esiPublicMarketOrdersGetterPublicOrders() {
@Test
public void esiPublicMarketOrdersGetterPublicStructures() {
try {
ApiResponse<List<Long>> apiResponse = UNIVERSE_API.getUniverseStructuresWithHttpInfo(DATASOURCE, null, null);
ApiResponse<Set<Long>> apiResponse = UNIVERSE_API.getUniverseStructuresWithHttpInfo(DATASOURCE, null, null);
validate(apiResponse.getHeaders());
} catch (ApiException ex) {
validate(ex.getResponseHeaders());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -787,15 +787,17 @@ private static Map<String, Boolean> getOptional(Class<?> esi) {
optional.put(methodName.toLowerCase().replaceFirst("get", "") + "enum", true);
} else if (methodName.startsWith("get")) {
Annotation[] annotations = method.getAnnotations();
boolean found = false;
for (Annotation annotation : annotations) {
if (io.swagger.annotations.ApiModelProperty.class.equals(annotation.annotationType())) {
optional.put(methodName.toLowerCase().replaceFirst("get", ""), annotations[0].toString().contains("required=false"));
found = true;
if (javax.annotation.Nonnull.class.equals(annotation.annotationType())) {
optional.put(methodName.toLowerCase().replaceFirst("get", ""), false);
break;
}
if (javax.annotation.Nullable.class.equals(annotation.annotationType())) {
optional.put(methodName.toLowerCase().replaceFirst("get", ""), true);
break;
}
}
assertTrue(method + " " + Arrays.toString(annotations), found);

}
}
return optional;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public void testToFlag_CharacterAssetsResponseLocationFlagEnum() {
|| (locationFlagEnum.toString().equals("SpecializedOreHold") && itemFlag.getFlagName().equals("SpecializedAsteroidHold"))
|| (locationFlagEnum.toString().equals("CorporationGoalDeliveries") && itemFlag.getFlagName().equals("CorpProjectsHangar"))
|| (locationFlagEnum.toString().equals("MobileDepotHold") && itemFlag.getFlagName().equals("MobileDepot"))
|| (locationFlagEnum.toString().equals("InfrastructureHangar") && itemFlag.getFlagName().equals("ColonyResourcesHold"))
);

}
Expand Down Expand Up @@ -109,6 +110,7 @@ public void testToFlag_CorporationAssetsResponseLocationFlagEnum() {
|| (locationFlagEnum.toString().equals("SpecializedOreHold") && itemFlag.getFlagName().equals("SpecializedAsteroidHold"))
|| (locationFlagEnum.toString().equals("CorporationGoalDeliveries") && itemFlag.getFlagName().equals("CorpProjectsHangar"))
|| (locationFlagEnum.toString().equals("MobileDepotHold") && itemFlag.getFlagName().equals("MobileDepot"))
|| (locationFlagEnum.toString().equals("InfrastructureHangar") && itemFlag.getFlagName().equals("ColonyResourcesHold"))
);
}
}
Expand Down Expand Up @@ -343,7 +345,7 @@ public void testToJournalRefType_Integer_String() {

@Test
public void testToJournalRefType_CharacterWalletJournalResponseRefTypeEnum() {
assertEquals(133, CharacterWalletJournalResponse.RefTypeEnum.values().length);
assertEquals(146, CharacterWalletJournalResponse.RefTypeEnum.values().length);
int undefined = 0;
for (CharacterWalletJournalResponse.RefTypeEnum refType : CharacterWalletJournalResponse.RefTypeEnum.values()) {
RawJournalRefType rawJournalRefType = RawConverter.toJournalRefType(refType);
Expand All @@ -357,7 +359,7 @@ public void testToJournalRefType_CharacterWalletJournalResponseRefTypeEnum() {

@Test
public void testToJournalRefType_CorporationWalletJournalResponseRefTypeEnum() {
assertEquals(133, CorporationWalletJournalResponse.RefTypeEnum.values().length);
assertEquals(146, CorporationWalletJournalResponse.RefTypeEnum.values().length);
int undefined = 0;
for (CorporationWalletJournalResponse.RefTypeEnum refType : CorporationWalletJournalResponse.RefTypeEnum.values()) {
RawJournalRefType rawJournalRefType = RawConverter.toJournalRefType(refType);
Expand Down

0 comments on commit 2394cab

Please sign in to comment.