-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #99 from aol/micro-jackson-configuration
Micro jackson configuration
- Loading branch information
Showing
50 changed files
with
508 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
...-mapper/src/test/java/com/aol/micro/server/general/exception/mapper/MyLocalException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.aol.micro.server.general.exception.mapper; | ||
|
||
public class MyLocalException extends Exception { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
micro-grizzly/src/test/java/app/jackson/com/aol/micro/server/copy/CustomRunnerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package app.jackson.com.aol.micro.server.copy; | ||
|
||
|
||
import static org.hamcrest.CoreMatchers.*; | ||
import static org.junit.Assert.assertThat; | ||
|
||
import java.util.Arrays; | ||
import java.util.concurrent.ExecutionException; | ||
|
||
import org.glassfish.jersey.media.multipart.MultiPartFeature; | ||
import org.junit.After; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
import com.aol.micro.server.MicroserverApp; | ||
import com.aol.micro.server.config.Microserver; | ||
import com.aol.micro.server.module.ConfigurableModule; | ||
import com.aol.micro.server.testing.RestAgent; | ||
|
||
@Microserver | ||
public class CustomRunnerTest { | ||
|
||
RestAgent rest = new RestAgent(); | ||
|
||
MicroserverApp server; | ||
@Before | ||
public void startServer(){ | ||
server = new MicroserverApp(ConfigurableModule | ||
.builder() | ||
.context("simple-app") | ||
.defaultResources(Arrays.asList(MultiPartFeature.class)) | ||
.build()); | ||
|
||
server.start(); | ||
|
||
} | ||
|
||
@After | ||
public void stopServer(){ | ||
server.stop(); | ||
} | ||
|
||
@Test | ||
public void runAppAndBasicTest() throws InterruptedException, ExecutionException{ | ||
|
||
|
||
assertThat(rest.postString("http://localhost:8080/simple-app/status/ping","{\"primitive\":null}").getStatus(),is(500)); | ||
|
||
|
||
} | ||
|
||
|
||
|
||
} |
31 changes: 31 additions & 0 deletions
31
micro-grizzly/src/test/java/app/jackson/com/aol/micro/server/copy/CustomStatusResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package app.jackson.com.aol.micro.server.copy; | ||
|
||
import java.io.EOFException; | ||
import java.io.InputStream; | ||
|
||
import javax.ws.rs.Consumes; | ||
import javax.ws.rs.GET; | ||
import javax.ws.rs.POST; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.Produces; | ||
import javax.ws.rs.core.MediaType; | ||
|
||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition; | ||
import org.glassfish.jersey.media.multipart.FormDataParam; | ||
|
||
import com.aol.cyclops.invokedynamic.ExceptionSoftener; | ||
import com.aol.micro.server.auto.discovery.Rest; | ||
|
||
@Rest | ||
@Path("/status") | ||
public class CustomStatusResource { | ||
|
||
@POST | ||
@Path("/ping") | ||
public String ping(MyEntity entity) { | ||
return "ok"; | ||
|
||
} | ||
|
||
|
||
} |
18 changes: 18 additions & 0 deletions
18
micro-grizzly/src/test/java/app/jackson/com/aol/micro/server/copy/MapperExtension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package app.jackson.com.aol.micro.server.copy; | ||
|
||
import org.springframework.stereotype.Component; | ||
|
||
import com.aol.micro.server.jackson.JacksonMapperConfigurator; | ||
import com.fasterxml.jackson.databind.DeserializationFeature; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
|
||
@Component | ||
public class MapperExtension implements JacksonMapperConfigurator { | ||
|
||
@Override | ||
public void accept(ObjectMapper t) { | ||
t.configure(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES, true); | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.