Skip to content

Commit

Permalink
Merge branch 'release/2.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Brutus5000 committed Sep 23, 2018
2 parents e29e374 + fb34bb5 commit 8946fde
Show file tree
Hide file tree
Showing 45 changed files with 999 additions and 246 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ before_install:
install:
- git clone https://github.com/FAForever/faf-stack.git faf-stack
&& pushd faf-stack
&& git checkout 2169c0c
&& git checkout 78c887c
&& cp -r config.template config
&& popd
- docker-compose -f faf-stack/docker-compose.yml up -d faf-db
Expand Down
4 changes: 1 addition & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ dependencies {
compile("org.springframework.boot:spring-boot-starter-security")
compile("org.springframework.boot:spring-boot-starter-thymeleaf")
compile("org.springframework.boot:spring-boot-starter-mail")
compile("de.codecentric:spring-boot-admin-starter-client:${springBootAdminClientVersion}")

compile("com.github.ben-manes.caffeine:caffeine")
compile("com.github.FAForever:faf-java-commons:${fafCommonsVersion}")
Expand All @@ -238,9 +239,6 @@ dependencies {
compile("com.yahoo.elide:elide-swagger:${elideVersion}")
compile("com.yahoo.elide:elide-datastore-hibernate5:${elideVersion}")
// compile("org.glassfish.jersey.core:jersey-common:2.26")
compile("com.zaxxer:HikariCP:${hikariCpVersion}") {
exclude(module: 'tools')
}

compile("org.luaj:luaj-jse:${luajVersion}")
compile("com.github.micheljung:nocatch:${nocatchVersion}")
Expand Down
9 changes: 4 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
profile=dev
springBootVersion=2.0.4.RELEASE
springBootVersion=2.0.5.RELEASE
jjwtVersion=0.7.0
javaxInjectVersion=1
elideVersion=4.2.3
Expand All @@ -8,20 +8,19 @@ propdepsVersion=0.0.7
swaggerVersion=2.6.1
swaggerCoreVersion=1.5.8
coverallsGradlePluginVersion=2.4.0
hikariCpVersion=2.4.6
springSecurityJwtVersion=1.0.9.RELEASE
springSecurityOauth2AutoConfigureVersion=2.0.1.RELEASE
springSecurityOauth2Version=2.3.3.RELEASE
guavaVersion=21.0-rc1
jetbrainsAnnotationsVersion=13.0
springBootAdminClientVersion=2.0.0
springBootAdminClientVersion=2.0.3
luajVersion=3.0.1
nocatchVersion=1.1
junitAddonsVersion=1.4
zohhakVersion=1.1.1
githubApiVersion=1.84
jgitVersionn=4.5.0.201609210915-r
fafCommonsVersion=09ffb08f9538f66e6e9bccabceae1e6123a3fa27
fafCommonsVersion=8dd4a6c991fd607153d8f7cd4bf43180c1f8a912
h2Version=1.4.193
jacksonDatatypeJsr310Version=2.8.11
mockitoVersion=2.19.0
Expand All @@ -33,4 +32,4 @@ thymeleafVersion=3.0.5.RELEASE
jsonapiConverterVersion=0.8
codacyCoverageReporterVersion=4.0.0
jsonVersion=20180130
javaxInterceptorApiVersion=1.2
javaxInterceptorApiVersion=1.2
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ In order to run the application from source code:

Given the number of required configuration values, it's easiest to run the API using `faf-stack`:

docker-compose up -d faf-api
docker-compose up -d faf-java-api

## Sample routes

Expand Down
29 changes: 29 additions & 0 deletions src/inttest/java/com/faforever/api/AbstractIntegrationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,20 @@
import com.faforever.api.config.ApplicationProfile;
import com.faforever.api.error.ErrorCode;
import com.faforever.api.utils.OAuthHelper;
import com.faforever.commons.api.dto.AbstractEntity;
import com.faforever.commons.api.dto.Avatar;
import com.faforever.commons.api.dto.AvatarAssignment;
import com.faforever.commons.api.dto.BanInfo;
import com.faforever.commons.api.dto.ModerationReport;
import com.faforever.commons.api.dto.Player;
import com.faforever.commons.api.dto.Tutorial;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.github.jasminb.jsonapi.JSONAPIDocument;
import com.github.jasminb.jsonapi.ResourceConverter;
import com.github.jasminb.jsonapi.exceptions.DocumentSerializationException;
import org.json.JSONObject;
import org.junit.Before;
import org.junit.runner.RunWith;
Expand All @@ -27,6 +37,7 @@
import org.springframework.web.context.WebApplicationContext;

import javax.transaction.Transactional;
import java.time.format.DateTimeFormatter;

import static org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers.springSecurity;

Expand All @@ -37,6 +48,8 @@
@Transactional
@Sql(executionPhase = ExecutionPhase.BEFORE_TEST_METHOD, scripts = "classpath:sql/prepDefaultUser.sql")
public abstract class AbstractIntegrationTest {
protected static final DateTimeFormatter OFFSET_DATE_TIME_FORMATTER = DateTimeFormatter.ISO_OFFSET_DATE_TIME;

protected final static String AUTH_WEBSITE = "WEBSITE";
protected final static String AUTH_USER = "USER";
protected final static String AUTH_MODERATOR = "MODERATOR";
Expand All @@ -47,6 +60,7 @@ public abstract class AbstractIntegrationTest {
@Autowired
protected WebApplicationContext context;
protected ObjectMapper objectMapper;
protected ResourceConverter resourceConverter;

@Before
public void setUp() {
Expand All @@ -59,6 +73,17 @@ public void setUp() {
this.objectMapper.registerModule(new JavaTimeModule());
this.objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
this.objectMapper.setSerializationInclusion(Include.NON_EMPTY);

// maybe use reflections library to find all subtypes of AbstractEntity
resourceConverter = new ResourceConverter(
objectMapper,
ModerationReport.class,
Player.class,
Tutorial.class,
Avatar.class,
AvatarAssignment.class,
BanInfo.class
);
}

protected RequestPostProcessor getOAuthToken(String... scope) {
Expand All @@ -69,4 +94,8 @@ protected void assertApiError(MvcResult mvcResult, ErrorCode errorCode) throws E
JSONObject resonseJson = new JSONObject(mvcResult.getResponse().getContentAsString());
JSONAssert.assertEquals(String.format("{\"errors\":[{\"code\":\"%s\"}]}", errorCode.getCode()), resonseJson, false);
}

protected <T extends AbstractEntity> byte[] createJsonApiContent(T entity) throws DocumentSerializationException {
return resourceConverter.writeDocument(new JSONAPIDocument<>(entity));
}
}
Loading

0 comments on commit 8946fde

Please sign in to comment.