start hacking

This commit is contained in:
Michael Buckley 2024-08-21 17:48:29 -04:00
parent dd326c335c
commit fb007bea9f
4 changed files with 8 additions and 50 deletions

View File

@ -63,7 +63,11 @@ public class JpaBindingTest {
long count = em.createQuery("select count(*) from ResRootEntity", Long.class).getSingleResult();
assertEquals(1, count);
em.createQuery("from ResRootEntity", ResRootEntity.class).getResultStream().forEach(e-> assertEquals("hello!", e.getString()));
em.createQuery("from ResRootEntity", ResRootEntity.class).getResultStream().forEach(e-> {
assertEquals(-1, e.myId);
assertEquals(-1, e.myPartitionId);
assertEquals("hello!", e.getString());
});
return true;
});
}

View File

@ -1,21 +1,18 @@
package ca.uhn.fhir.jpa.model.pkspike;
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamCoords;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.OneToMany;
import jakarta.persistence.Table;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.hibernate.annotations.OptimisticLock;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Set;
@SuppressWarnings("JpaDataSourceORMInspection")
@Entity
@Table(
name = "RES_ROOT"

View File

@ -1,43 +0,0 @@
package ca.uhn.fhir.jpa.test;
import ca.uhn.fhir.jpa.test.config.TestHSearchAddInConfig;
import ca.uhn.fhir.jpa.test.config.TestR4Config;
import jakarta.inject.Inject;
import jakarta.persistence.EntityManagerFactory;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.transaction.support.TransactionTemplate;
import static org.junit.jupiter.api.Assertions.fail;
@ContextConfiguration(classes = {
TestHSearchAddInConfig.NoFT.class
})
public class KeyTypeOverrideTest extends BaseJpaR4Test {
private static final Logger ourLog = LoggerFactory.getLogger(KeyTypeOverrideTest.class);
@Inject
EntityManagerFactory myEntityManagerFactory;
@Test
void empty() {
// given
try (var em = myEntityManagerFactory.createEntityManager()) {
newTxTemplate().execute((status)->{
em.createQuery("from ResourceTable").getResultStream()
.forEach(e->{
ourLog.info("found resource");
});
return null;
});
}
// when
// then
}
}

View File

@ -59,12 +59,12 @@ public class LoggingExtension implements BeforeEachCallback, BeforeTestExecution
}
@Override
public void beforeTestExecution(ExtensionContext context) throws Exception {
public void beforeTestExecution(ExtensionContext context) {
getLoggerForTestClass(context).info("Starting test case [{}]", getMethodName(context));
}
@Override
public void afterTestExecution(ExtensionContext context) throws Exception {
public void afterTestExecution(ExtensionContext context) {
getLoggerForTestClass(context).info("Finished test case [{}]", getMethodName(context));
}