Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
akphi committed Apr 14, 2023
1 parent af29110 commit abaf714
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,13 @@

public class BaseServerJacksonJsonProvider extends JacksonJsonProvider implements ContextResolver<ObjectMapper>
{
private final ObjectMapper objectMapper;

public BaseServerJacksonJsonProvider()
{
objectMapper = new ObjectMapper();
objectMapper.findAndRegisterModules();
objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
}
private final ObjectMapper objectMapper = new ObjectMapper()
.findAndRegisterModules()
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);

@Override
public ObjectMapper getContext(Class<?> type)
{
return objectMapper;
return this.objectMapper;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,20 @@

public class LegendSDLCServerForTestJacksonJsonProvider extends JacksonJsonProvider implements ContextResolver<ObjectMapper>
{
private final ObjectMapper objectMapper;

public LegendSDLCServerForTestJacksonJsonProvider()
{
objectMapper = new ObjectMapper();
objectMapper.findAndRegisterModules();
objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
objectMapper.addMixIn(Project.class, InMemoryMixins.Project.class);
objectMapper.addMixIn(Workspace.class, InMemoryMixins.Workspace.class);
objectMapper.addMixIn(Entity.class, InMemoryMixins.Entity.class);
objectMapper.addMixIn(Revision.class, InMemoryMixins.Revision.class);
objectMapper.addMixIn(ProjectDependency.class, ProjectDependencyMixin.class);
objectMapper.addMixIn(VersionId.class, VersionIdMixin.class);
objectMapper.addMixIn(Review.class, InMemoryMixins.Review.class);
}
private final ObjectMapper objectMapper = new ObjectMapper()
.findAndRegisterModules()
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.addMixIn(Project.class, InMemoryMixins.Project.class)
.addMixIn(Workspace.class, InMemoryMixins.Workspace.class)
.addMixIn(Entity.class, InMemoryMixins.Entity.class)
.addMixIn(Revision.class, InMemoryMixins.Revision.class)
.addMixIn(ProjectDependency.class, ProjectDependencyMixin.class)
.addMixIn(VersionId.class, VersionIdMixin.class)
.addMixIn(Review.class, InMemoryMixins.Review.class);

@Override
public ObjectMapper getContext(Class<?> type)
{
return objectMapper;
return this.objectMapper;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,6 @@ public void testParseProjectId()

private long[] getGitLabIdsForTest()
{
return new long[]{0, 1, 2, 3, 4, 5, 64, 127, 511, 1024, 17_560_438, 1_030_991_200, Integer.MAX_VALUE};
return new long[]{0, 1, 2, 3, 4, 5, 64, 127, 511, 1024, 17_560_438, 1_030_991_200, Integer.MAX_VALUE, Long.MAX_VALUE};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,29 +73,24 @@ private Client createClient()

static class SDLCServerClientRuleJacksonJsonProvider extends JacksonJsonProvider implements ContextResolver<ObjectMapper>
{
private final ObjectMapper objectMapper;

public SDLCServerClientRuleJacksonJsonProvider()
{
objectMapper = new ObjectMapper();
this.objectMapper.findAndRegisterModules();
this.objectMapper.enable(SerializationFeature.INDENT_OUTPUT);
this.objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
this.objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
this.objectMapper.addMixIn(Project.class, InMemoryMixins.Project.class);
this.objectMapper.addMixIn(Workspace.class, InMemoryMixins.Workspace.class);
this.objectMapper.addMixIn(Entity.class, InMemoryMixins.Entity.class);
this.objectMapper.addMixIn(Revision.class, InMemoryMixins.Revision.class);
this.objectMapper.addMixIn(Review.class, InMemoryMixins.Review.class);
this.objectMapper.addMixIn(ProjectRevision.class, ProjectRevisionMixin.class);
this.objectMapper.addMixIn(ProjectDependency.class, ProjectDependencyMixin.class);
this.objectMapper.addMixIn(VersionId.class, VersionIdMixin.class);
}
private final ObjectMapper objectMapper = new ObjectMapper()
.findAndRegisterModules()
.enable(SerializationFeature.INDENT_OUTPUT)
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.setSerializationInclusion(JsonInclude.Include.NON_NULL)
.addMixIn(Project.class, InMemoryMixins.Project.class)
.addMixIn(Workspace.class, InMemoryMixins.Workspace.class)
.addMixIn(Entity.class, InMemoryMixins.Entity.class)
.addMixIn(Revision.class, InMemoryMixins.Revision.class)
.addMixIn(Review.class, InMemoryMixins.Review.class)
.addMixIn(ProjectRevision.class, ProjectRevisionMixin.class)
.addMixIn(ProjectDependency.class, ProjectDependencyMixin.class)
.addMixIn(VersionId.class, VersionIdMixin.class);

@Override
public ObjectMapper getContext(Class<?> type)
{
return objectMapper;
return this.objectMapper;
}
}
}
Expand Down

0 comments on commit abaf714

Please sign in to comment.