Remove bad dependency
This commit is contained in:
parent
c532d1a25b
commit
748c13d0dc
|
@ -1,5 +1,25 @@
|
|||
package ca.uhn.fhir.rest.server.interceptor;
|
||||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2016 University Health Network
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ package ca.uhn.fhir.parser;
|
|||
import org.hl7.fhir.dstu3.exceptions.FHIRException;
|
||||
import org.hl7.fhir.dstu3.model.Identifier;
|
||||
import org.hl7.fhir.dstu3.model.MessageHeader;
|
||||
import org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
@ -11,7 +10,7 @@ import ca.uhn.fhir.model.api.annotation.Description;
|
|||
import ca.uhn.fhir.model.api.annotation.Extension;
|
||||
import ca.uhn.fhir.model.api.annotation.ResourceDef;
|
||||
|
||||
@ResourceDef(name = "FooMessageHeader")
|
||||
@ResourceDef(name = "MessageHeader")
|
||||
public class FooMessageHeader extends MessageHeader {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
@ -4,17 +4,13 @@ import static org.hamcrest.Matchers.contains;
|
|||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.hamcrest.Matchers.stringContainsInOrder;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
@ -22,6 +18,7 @@ import java.util.UUID;
|
|||
import org.apache.commons.io.IOUtils;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.hamcrest.core.StringContains;
|
||||
import org.hl7.fhir.dstu3.exceptions.FHIRException;
|
||||
import org.hl7.fhir.dstu3.model.Address.AddressUse;
|
||||
import org.hl7.fhir.dstu3.model.Address.AddressUseEnumFactory;
|
||||
import org.hl7.fhir.dstu3.model.Attachment;
|
||||
|
@ -78,6 +75,8 @@ import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator;
|
|||
import ca.uhn.fhir.parser.PatientWithExtendedContactDstu3.CustomContactComponent;
|
||||
import ca.uhn.fhir.rest.server.Constants;
|
||||
import ca.uhn.fhir.util.TestUtil;
|
||||
import ca.uhn.fhir.validation.FhirValidator;
|
||||
import ca.uhn.fhir.validation.ValidationResult;
|
||||
import net.sf.json.JSON;
|
||||
import net.sf.json.JSONSerializer;
|
||||
import net.sf.json.JsonConfig;
|
||||
|
@ -112,30 +111,51 @@ public class JsonParserDstu3Test {
|
|||
ourLog.info(output);
|
||||
assertThat(output, containsString("\"div\": \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\">VALUE</div>\""));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testValidateCustomStructure() throws Exception {
|
||||
|
||||
FooMessageHeader.FooMessageSourceComponent source = new FooMessageHeader.FooMessageSourceComponent();
|
||||
source.getMessageHeaderApplicationId().setValue("APPID");
|
||||
source.setName("NAME");
|
||||
source.setEndpoint("http://foo");
|
||||
|
||||
FooMessageHeader header = new FooMessageHeader();
|
||||
header.setTimestamp(new Date());
|
||||
header.getEvent().setSystem("http://system").setCode("value");
|
||||
header.setSource(source);
|
||||
|
||||
FhirValidator val = ourCtx.newValidator();
|
||||
val.setValidateAgainstStandardSchema(true);
|
||||
val.setValidateAgainstStandardSchematron(true);
|
||||
|
||||
ValidationResult result = val.validateWithResult(header);
|
||||
|
||||
ourLog.info(ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(result.toOperationOutcome()));
|
||||
assertTrue(result.isSuccessful());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEncodeUndeclaredBlock() throws Exception {
|
||||
FooMessageHeader.FooMessageSourceComponent source = new FooMessageHeader.FooMessageSourceComponent();
|
||||
source.getMessageHeaderApplicationId().setValue("APPID");
|
||||
source.setName("NAME");
|
||||
|
||||
|
||||
FooMessageHeader header = new FooMessageHeader();
|
||||
header.setSource(source);
|
||||
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.addEntry().setResource(header);
|
||||
|
||||
IParser p = ourCtx.newJsonParser();
|
||||
p.setPrettyPrint(true);
|
||||
|
||||
String encode = p.encodeResourceToString(bundle);
|
||||
ourLog.info(encode);
|
||||
|
||||
assertThat(encode, containsString("\"value\": \"APPID\""));
|
||||
IParser p = ourCtx.newJsonParser();
|
||||
p.setPrettyPrint(true);
|
||||
|
||||
String encode = p.encodeResourceToString(bundle);
|
||||
ourLog.info(encode);
|
||||
|
||||
assertThat(encode, containsString("\"value\": \"APPID\""));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* See #344
|
||||
*/
|
||||
|
@ -727,8 +747,8 @@ public class JsonParserDstu3Test {
|
|||
ourLog.info(encoded);
|
||||
|
||||
assertThat(encoded, containsString("Patient"));
|
||||
assertThat(encoded,
|
||||
stringContainsInOrder("\"tag\"", "\"system\": \"foo\",", "\"code\": \"bar\"", "\"system\": \"" + Constants.TAG_SUBSETTED_SYSTEM + "\"", "\"code\": \"" + Constants.TAG_SUBSETTED_CODE + "\""));
|
||||
assertThat(encoded, stringContainsInOrder("\"tag\"", "\"system\": \"foo\",", "\"code\": \"bar\"", "\"system\": \"" + Constants.TAG_SUBSETTED_SYSTEM + "\"",
|
||||
"\"code\": \"" + Constants.TAG_SUBSETTED_CODE + "\""));
|
||||
assertThat(encoded, not(containsString("THE DIV")));
|
||||
assertThat(encoded, containsString("family"));
|
||||
assertThat(encoded, not(containsString("maritalStatus")));
|
||||
|
@ -801,7 +821,7 @@ public class JsonParserDstu3Test {
|
|||
|
||||
PatientWithExtendedContactDstu3 patient = new PatientWithExtendedContactDstu3();
|
||||
patient.setId("123");
|
||||
|
||||
|
||||
CustomContactComponent customContactComponent = new CustomContactComponent();
|
||||
customContactComponent.getEyeColour().setValue("EYE");
|
||||
customContactComponent.getName().addFamily("FAMILY");
|
||||
|
@ -809,8 +829,10 @@ public class JsonParserDstu3Test {
|
|||
|
||||
String val = parser.encodeResourceToString(patient);
|
||||
ourLog.info(val);
|
||||
|
||||
assertEquals("{\"resourceType\":\"Patient\",\"id\":\"123\",\"contact\":[{\"extension\":[{\"url\":\"http://foo.com/contact-eyecolour\",\"valueIdentifier\":{\"value\":\"EYE\"}}],\"name\":{\"family\":[\"FAMILY\"]}}]}", val);
|
||||
|
||||
assertEquals(
|
||||
"{\"resourceType\":\"Patient\",\"id\":\"123\",\"contact\":[{\"extension\":[{\"url\":\"http://foo.com/contact-eyecolour\",\"valueIdentifier\":{\"value\":\"EYE\"}}],\"name\":{\"family\":[\"FAMILY\"]}}]}",
|
||||
val);
|
||||
|
||||
FhirContext newCtx = FhirContext.forDstu3();
|
||||
PatientWithExtendedContactDstu3 actual = newCtx.newJsonParser().parseResource(PatientWithExtendedContactDstu3.class, val);
|
||||
|
@ -941,7 +963,7 @@ public class JsonParserDstu3Test {
|
|||
" }\n" +
|
||||
"}";
|
||||
//@formatter:on
|
||||
|
||||
|
||||
ExplanationOfBenefit eob = ourCtx.newJsonParser().parseResource(ExplanationOfBenefit.class, input);
|
||||
assertEquals(Reference.class, eob.getCoverage().getCoverage().getClass());
|
||||
|
||||
|
@ -1046,7 +1068,6 @@ public class JsonParserDstu3Test {
|
|||
assertThat(ourCtx.newJsonParser().setOmitResourceId(true).encodeResourceToString(p), not(containsString("123")));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testParseAndEncodeBundle() throws Exception {
|
||||
|
@ -1264,7 +1285,6 @@ public class JsonParserDstu3Test {
|
|||
assertEquals(StringType.class, comm.getPayload().get(2).getContent().getClass());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testParseAndEncodeComments() throws IOException {
|
||||
//@formatter:off
|
||||
|
@ -1417,10 +1437,9 @@ public class JsonParserDstu3Test {
|
|||
} catch (DataFormatException e) {
|
||||
assertEquals("Failed to parse JSON content, error was: Content does not appear to be FHIR JSON, first non-whitespace character was: '[' (must be '{')", e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
|
||||
assertEquals(Bundle.class, ourCtx.newJsonParser().parseResource(" {\"resourceType\" : \"Bundle\"}").getClass());
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -1486,7 +1505,7 @@ public class JsonParserDstu3Test {
|
|||
|
||||
}
|
||||
|
||||
@Test(expected=DataFormatException.class)
|
||||
@Test(expected = DataFormatException.class)
|
||||
public void testParseWithTrailingContent() throws Exception {
|
||||
//@formatter:off
|
||||
String bundle = "{\n" +
|
||||
|
@ -1497,7 +1516,7 @@ public class JsonParserDstu3Test {
|
|||
|
||||
Bundle b = ourCtx.newJsonParser().parseResource(Bundle.class, bundle);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* See #163
|
||||
*/
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-jpaserver-base</artifactId>
|
||||
<version>2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
|
|
|
@ -78,6 +78,12 @@
|
|||
DSTU2 HL7org structures with the JAX-RS module. Thanks to Carlo Mion
|
||||
for the pull request!
|
||||
</action>
|
||||
<action type="fix">
|
||||
hapi-fhir-testpage-overlay project contained an unneccesary
|
||||
dependency on hapi-fhir-jpaserver-base module, which resulted in
|
||||
projects using the overlay having a large number of unnneded
|
||||
JARs included
|
||||
</action>
|
||||
</release>
|
||||
<release version="1.6" date="2016-07-07">
|
||||
<action type="fix">
|
||||
|
|
Loading…
Reference in New Issue