Add tests and license headers

This commit is contained in:
jamesagnew 2019-02-04 16:34:39 -05:00
parent e401ec86e4
commit d4af1ee2a3
15 changed files with 101 additions and 16 deletions

View File

@ -1,5 +1,25 @@
package ca.uhn.fhir.jpa.subscription.module.interceptor;
/*-
* #%L
* HAPI FHIR Subscription Server
* %%
* Copyright (C) 2014 - 2019 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 ca.uhn.fhir.jpa.model.interceptor.api.Hook;
import ca.uhn.fhir.jpa.model.interceptor.api.Interceptor;
import ca.uhn.fhir.jpa.model.interceptor.api.Pointcut;

View File

@ -1,5 +1,25 @@
package ca.uhn.fhir.jpa.subscription.module.subscriber;
/*-
* #%L
* HAPI FHIR Subscription Server
* %%
* Copyright (C) 2014 - 2019 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 com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

View File

@ -1,5 +1,25 @@
package ca.uhn.fhir.rest.server;
/*-
* #%L
* HAPI FHIR - Server Framework
* %%
* Copyright (C) 2014 - 2019 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%
*/
/**
* @see <a href="http://hapifhir.io/doc_rest_server.html#extended_elements_support">Extended Elements Support</a>
*/

View File

@ -139,6 +139,7 @@ public class ElementsParamR4Test {
});
}
@Test
public void testMultiResourceElementsFilter() throws IOException {
createProcedureWithLongChain();
@ -183,6 +184,30 @@ public class ElementsParamR4Test {
});
}
@Test
public void testMultiResourceElementsFilterWithMetadataExcludedStandardMode() throws IOException {
ourServlet.setElementsSupport(ElementsSupportEnum.STANDARD);
createProcedureWithLongChain();
verifyXmlAndJson(
"http://localhost:" + ourPort + "/Procedure?_include=*&_elements=Procedure.reasonCode,Observation.status,Observation.subject,Observation.value&_elements:exclude=*.meta",
bundle -> {
Procedure procedure = (Procedure) bundle.getEntry().get(0).getResource();
assertEquals(true, procedure.getMeta().isEmpty());
assertEquals("REASON_CODE", procedure.getReasonCode().get(0).getCoding().get(0).getCode());
assertEquals(1, procedure.getUsedCode().size());
DiagnosticReport dr = (DiagnosticReport) bundle.getEntry().get(1).getResource();
assertEquals(true, dr.getMeta().isEmpty());
assertEquals(1, dr.getResult().size());
Observation obs = (Observation ) bundle.getEntry().get(2).getResource();
assertEquals(true, obs.getMeta().isEmpty());
assertEquals(Observation.ObservationStatus.FINAL, obs.getStatus());
assertEquals(1, obs.getCode().getCoding().size());
assertEquals("STRING VALUE", obs.getValueStringType().getValue());
});
}
@Test
public void testElementsFilterWithComplexPath() throws IOException {
createProcedureWithLongChain();