Skip to content
This repository has been archived by the owner on Oct 15, 2019. It is now read-only.

Commit

Permalink
Added Maven framework
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesMarcogliese committed Oct 16, 2017
1 parent 0536e46 commit 368df40
Show file tree
Hide file tree
Showing 12 changed files with 372 additions and 29 deletions.
36 changes: 28 additions & 8 deletions patientgenerator.iml
Original file line number Diff line number Diff line change
@@ -1,31 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="web" name="Web">
<configuration>
<descriptors>
<deploymentDescriptor name="web.xml" url="file:https://$MODULE_DIR$/web/WEB-INF/web.xml" />
</descriptors>
<webroots>
<root url="file:https://$MODULE_DIR$/web" relative="/" />
<root url="file:https://$MODULE_DIR$/src/main/webapp" relative="/" />
</webroots>
<sourceRoots>
<root url="file:https://$MODULE_DIR$/src/main/java" />
<root url="file:https://$MODULE_DIR$/src/main/resources" />
</sourceRoots>
</configuration>
<facet type="webservices" name="WebServices">
<configuration ws.engine="Glassfish / JAX-WS 2.2 RI / Metro 1.X / JWSDP 2.2" />
</facet>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file:https://$MODULE_DIR$/target/classes" />
<output-test url="file:https://$MODULE_DIR$/target/test-classes" />
<content url="file:https://$MODULE_DIR$">
<sourceFolder url="file:https://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file:https://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file:https://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file:https://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file:https://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="PROVIDED" name="GlassFish 5.0.0" level="application_server_libraries" />
<orderEntry type="library" name="JAX-WS-Glassfish / JAX-WS 2.2 RI / Metro 1.X / JWSDP 2.2" level="project" />
<orderEntry type="library" name="hapi-fhir-base-3.0.0" level="project" />
<orderEntry type="library" name="HttpClient" level="project" />
<orderEntry type="module-library">
<library name="JUnit5">
<CLASSES>
Expand All @@ -36,6 +42,20 @@
<SOURCES />
</library>
</orderEntry>
<orderEntry type="library" name="javax.json-api-1.1" level="project" />
<orderEntry type="library" name="Maven: ca.uhn.hapi.fhir:hapi-fhir-base:3.0.0" level="project" />
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.1" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.woodstox:woodstox-core-asl:4.4.1" level="project" />
<orderEntry type="library" name="Maven: javax.xml.stream:stax-api:1.0-2" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.woodstox:stax2-api:3.1.4" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.6" level="project" />
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.10" level="project" />
<orderEntry type="library" name="Maven: commons-io:commons-io:2.5" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:jcl-over-slf4j:1.7.25" level="project" />
<orderEntry type="library" name="Maven: ca.uhn.hapi.fhir:hapi-fhir-structures-dstu2:3.0.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.6" level="project" />
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.2" level="project" />
<orderEntry type="library" name="Maven: org.glassfish:javax.json:1.0.4" level="project" />
</component>
</module>
14 changes: 14 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@
<groupId>me.jamesmarcogliese.patientgenerator</groupId>
<artifactId>patientgenerator</artifactId>
<version>0.1</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<packaging>war</packaging>

<name>PatientGenerator</name>
Expand All @@ -25,10 +37,12 @@
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.3</version>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.json</artifactId>
<version>1.0.4</version>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package core.resources;
package core;

import java.io.File;
import java.io.FileInputStream;
Expand Down Expand Up @@ -30,7 +30,7 @@ public String getPropertyValue(String key){
String value = "";

try {
URL path = this.getClass().getResource("config.properties");
URL path = PropertiesService.class.getClassLoader().getResource("properties/config.properties");
File file = new File(path.getFile());
input = new FileInputStream(file);

Expand All @@ -50,7 +50,7 @@ public String getPropertyValue(String key){
*/
public File getResourceFile(String filename){

URL path = this.getClass().getResource(filename);
URL path = PropertiesService.class.getClassLoader().getResource(filename);
File file = new File(path.getFile()).getAbsoluteFile();
return file;
}
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/fhir/FhirUtility.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
import ca.uhn.fhir.model.dstu2.resource.Patient;
import ca.uhn.fhir.model.dstu2.valueset.*;
import ca.uhn.fhir.model.primitive.*;
import com.google.gson.JsonObject;
import core.model.Metadata;
import core.model.componentModel.Address;
import core.model.componentModel.AlternateIdentifier;
import core.model.componentModel.Demographic;
import core.model.componentModel.Name;
import core.resources.PropertiesService;
import core.PropertiesService;
import fhir.configuration.FhirConfigurationSection;
import fhir.configuration.FhirEndpoint;
import org.apache.http.HttpEntity;
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/randomizer/RandomizerService.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package randomizer;

import core.resources.PropertiesService;
import core.PropertiesService;
import core.model.common.Patient;
import randomizer.common.GivenNameGenderPair;
import randomizer.common.SeedData;
import randomizer.utilities.OHIPUtil;

import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.time.LocalDateTime;
import java.util.Objects;
import java.util.concurrent.ThreadLocalRandom;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ fhirEndpointUsername=user
fhirEndpointPassword=pass

# seed data
seedDataFile=seedData.xml
seedDataFile=xml/seedData.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
package test;

import ca.uhn.fhir.model.dstu2.resource.Patient;
import ca.uhn.fhir.model.dstu2.valueset.AdministrativeGenderEnum;
import core.model.Metadata;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package test;

import ca.uhn.fhir.model.dstu2.resource.Patient;
import core.model.Metadata;
import core.model.componentModel.*;
import fhir.FhirUtility;
import messaging.messageReceiver.GenerationService;
import messaging.model.GenerationResponse;
import org.junit.jupiter.api.AfterEach;
Expand All @@ -15,7 +11,9 @@
import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;

import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

class MessagingTests {
private Demographic options;
private GenerationService service;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
package test;

import core.resources.PropertiesService;
import core.PropertiesService;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.io.File;

import static org.junit.jupiter.api.Assertions.assertEquals;

class PropertiesTests {
Expand All @@ -29,7 +25,7 @@ void testPropertyRetrieval(){

String value = propertiesService.getPropertyValue("seedDataFile");

assertEquals("resources/seedData.xml", value);
assertEquals("xml/seedData.xml", value);
}

/*@Test
Expand Down
9 changes: 9 additions & 0 deletions target/classes/properties/config.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# endpoint settings
fhirEndpointName=test
fhirEndpointAddress=https://httpbin.org/post
fhirEndpointAuth=false
fhirEndpointUsername=user
fhirEndpointPassword=pass

# seed data
seedDataFile=xml/seedData.xml
Loading

0 comments on commit 368df40

Please sign in to comment.