Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kwakeroni committed Nov 8, 2017
1 parent 35e4448 commit 6b25682
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
2 changes: 1 addition & 1 deletion parameters-features/features/features.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@

<feature name="businessparameters-basic-inmemory" version="${project.version}" hidden="true">
<feature>businessparameters-backend-inmemory</feature>
<bundle>mvn:be.kwakeroni.parameters.types/parameters-types-api/${project.version}</bundle>ls
<bundle>mvn:be.kwakeroni.parameters.types/parameters-types-api/${project.version}</bundle>
<bundle>mvn:be.kwakeroni.parameters.types/parameters-types-support/${project.version}</bundle>
<bundle>mvn:be.kwakeroni.parameters.basic/parameters-basic-common/${project.version}</bundle>
<bundle>mvn:be.kwakeroni.parameters.basic/parameters-basic-inmemory/${project.version}</bundle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ private static class Server implements AutoCloseable {
public Server(int port, String root, Object... resources) throws IOException {
ResourceConfig config = new ApplicationAdapter(ofSingletons(resources));
config.setPropertiesAndFeatures(Collections.singletonMap("com.sun.jersey.api.json.POJOMappingFeature", true));
// config.getContainerResponseFilters().add(new CORSFilter());

this.server = HttpServerFactory.create("http://127.0.0.1:" + port + root,
ContainerFactory.createContainer(HttpHandler.class, config, null));
Expand All @@ -84,22 +83,25 @@ public void close() throws Exception {
}

private static PetshopRestService createPetshopRestService() {
BusinessParameters parameters = ServiceLoader.load(BusinessParametersFactory.class).iterator().next().getInstance();
return new PetshopRestService(new ParametersPriceCalculator(parameters));
return new PetshopRestService(
new ParametersPriceCalculator(
createBusinessParameters()));
}

private static RestBackendAdapter createAdapter() {
RestBackendAdapterFactory factory = new RestBackendAdapterFactory();
// factory.setBackendType(testData::acceptBackend);
return factory.newInstance();
}

private static RestParameterManagement createManagement() {
RestParameterManagementFactory factory = new RestParameterManagementFactory();
//factory.setBackendType(testData::acceptBackend);
return factory.newInstance();
}

private static BusinessParameters createBusinessParameters() {
return ServiceLoader.load(BusinessParametersFactory.class).iterator().next().getInstance();
}

private static Application ofSingletons(Object... singletons) {
return new Application() {
@Override
Expand Down Expand Up @@ -128,16 +130,6 @@ public Response get(@PathParam("path") String path) throws Exception {
// .header("Content-Disposition", "attachment; filename=\"" + file.getName() + "\"" ) //optional
.build();
}

// private MediaType getMediaType(File file) {
// String name = file.getName().toLowerCase();
// if (name.endsWith(".html") || name.endsWith(".htm")) {
// return MediaType.TEXT_HTML_TYPE;
// } else {
// return MediaType.APPLICATION_OCTET_STREAM_TYPE;
// }
// }

}

@Path("/petshop")
Expand Down

0 comments on commit 6b25682

Please sign in to comment.