Clean up a few unused methods and move test classes into test project

This commit is contained in:
James Agnew 2019-10-03 14:57:00 -04:00
parent d73bb9b7c1
commit a3b9db1363
12 changed files with 63 additions and 56 deletions

View File

@ -319,6 +319,7 @@ public class PersistedJpaBundleProvider implements IBundleProvider {
// Execute the query and make sure we return distinct results
List<IBaseResource> resources = new ArrayList<>();
theSearchBuilder.loadResourcesByPid(thePids, includedPidList, resources, false, myRequest);
// resources.removeIf(t->t == null); aaaaaaaaabbbbbbbb
// Interceptor call: STORAGE_PRESHOW_RESOURCE
// This can be used to remove results from the search result details before

View File

@ -6,7 +6,7 @@ import ca.uhn.fhir.interceptor.api.Pointcut;
import ca.uhn.fhir.jpa.config.TestDstu3Config;
import ca.uhn.fhir.jpa.dao.DaoConfig;
import ca.uhn.fhir.jpa.dao.IFhirResourceDaoPatient;
import ca.uhn.fhir.jpa.model.concurrency.PointcutLatch;
import ca.uhn.test.concurrency.PointcutLatch;
import ca.uhn.fhir.jpa.util.ExpungeOptions;
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
import org.hl7.fhir.dstu3.model.Patient;

View File

@ -3,7 +3,7 @@ package ca.uhn.fhir.jpa.dao.expunge;
import ca.uhn.fhir.interceptor.api.HookParams;
import ca.uhn.fhir.jpa.config.TestDstu3Config;
import ca.uhn.fhir.jpa.dao.DaoConfig;
import ca.uhn.fhir.jpa.model.concurrency.PointcutLatch;
import ca.uhn.test.concurrency.PointcutLatch;
import com.google.common.collect.Sets;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.junit.After;

View File

@ -47,9 +47,6 @@ public class BinaryStorageEntity {
private String myHash;
public Date getPublished() {
if (myPublished == null) {
return null;
}
return new Date(myPublished.getTime());
}
@ -61,22 +58,10 @@ public class BinaryStorageEntity {
return myHash;
}
public void setHash(String theHash) {
myHash = theHash;
}
public String getBlobId() {
return myBlobId;
}
public void setBlobId(String theBlobId) {
myBlobId = theBlobId;
}
public String getResourceId() {
return myResourceId;
}
public void setResourceId(String theResourceId) {
myResourceId = theResourceId;
}
@ -85,10 +70,6 @@ public class BinaryStorageEntity {
return mySize;
}
public void setSize(int theSize) {
mySize = theSize;
}
public String getBlobContentType() {
return myBlobContentType;
}

View File

@ -78,25 +78,10 @@ public class ForcedId {
myForcedId = theForcedId;
}
public ResourceTable getResource() {
return myResource;
}
public void setResource(ResourceTable theResource) {
myResource = theResource;
}
public Long getResourcePid() {
if (myResourcePid == null) {
return myResource.getId();
}
return myResourcePid;
}
public void setResourcePid(ResourceTable theResourcePid) {
myResource = theResourcePid;
}
public String getResourceType() {
return myResourceType;
}
@ -105,8 +90,4 @@ public class ForcedId {
myResourceType = theResourceType;
}
public void setResourcePid(Long theResourcePid) {
myResourcePid = theResourcePid;
}
}

View File

@ -30,12 +30,10 @@ import javax.persistence.*;
import java.io.Serializable;
import java.util.Collection;
//@formatter:on
@Entity
@Table(name = "HFJ_TAG_DEF", uniqueConstraints = {
@UniqueConstraint(name = "IDX_TAGDEF_TYPESYSCODE", columnNames = { "TAG_TYPE", "TAG_SYSTEM", "TAG_CODE" })
})
//@formatter:off
public class TagDefinition implements Serializable {
private static final long serialVersionUID = 1L;
@ -117,24 +115,18 @@ public class TagDefinition implements Serializable {
myHashCode = null;
}
public Tag toTag() {
return new Tag(getSystem(), getCode(), getDisplay());
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof TagDefinition)) {
return false;
}
TagDefinition other = (TagDefinition) obj;
EqualsBuilder b = new EqualsBuilder();
if (myId != null && other.myId != null) {
b.append(myId, other.myId);
} else {
@ -142,7 +134,7 @@ public class TagDefinition implements Serializable {
b.append(mySystem, other.mySystem);
b.append(myCode, other.myCode);
}
return b.isEquals();
}

View File

@ -0,0 +1,45 @@
package ca.uhn.fhir.jpa.model.entity;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
public class TagDefinitionTest {
@Test
public void testToString() {
TagDefinition def = new TagDefinition();
def.setCode("my_code");
def.setSystem("my_system");
def.setDisplay("my_display");
assertEquals("TagDefinition[id=<null>,system=my_system,code=my_code,display=my_display]", def.toString());
}
@Test
public void testEquals() {
TagDefinition def = new TagDefinition();
def.setCode("my_code");
def.setSystem("my_system");
def.setDisplay("my_display");
TagDefinition def2 = new TagDefinition();
def2.setCode("my_code2");
def2.setSystem("my_system");
def2.setDisplay("my_display");
assertEquals(def, def);
assertNotEquals(def, def2);
assertNotEquals(def, "");
}
@Test
public void testHashCode() {
TagDefinition def = new TagDefinition();
def.setCode("my_code");
def.setSystem("my_system");
def.setDisplay("my_display");
assertEquals (-2125810377,def.hashCode());
assertEquals (-2125810377,def.hashCode());
}
}

View File

@ -4,8 +4,8 @@ import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.interceptor.api.HookParams;
import ca.uhn.fhir.interceptor.api.IInterceptorService;
import ca.uhn.fhir.interceptor.api.Pointcut;
import ca.uhn.fhir.jpa.model.concurrency.IPointcutLatch;
import ca.uhn.fhir.jpa.model.concurrency.PointcutLatch;
import ca.uhn.test.concurrency.IPointcutLatch;
import ca.uhn.test.concurrency.PointcutLatch;
import ca.uhn.fhir.jpa.subscription.module.BaseSubscriptionDstu3Test;
import ca.uhn.fhir.jpa.subscription.module.ResourceModifiedMessage;
import ca.uhn.fhir.jpa.subscription.module.cache.SubscriptionChannelFactory;

View File

@ -15,6 +15,13 @@
<url>http://jamesagnew.github.io/hapi-fhir/</url>
<dependencies>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>4.1.0-SNAPSHOT</version>
</dependency>
<!-- General -->
<dependency>
<groupId>org.eclipse.jetty</groupId>