Commit 6d18ee17 authored by Thomas Huster's avatar Thomas Huster

fixed core model service usage in core model tests

parent 2818512e
Pipeline #15413 failed with stages
in 2 minutes and 3 seconds
......@@ -12,6 +12,7 @@
<booleanAttribute key="clearwslog" value="false"/>
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
<booleanAttribute key="default" value="false"/>
<setAttribute key="deselected_workspace_bundles"/>
<booleanAttribute key="includeOptional" value="false"/>
<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
<setAttribute key="name.schedenig.eclipse.grepconsole.DisabledIds"/>
......@@ -41,22 +42,27 @@
<stringAttribute key="product" value="org.eclipse.platform.ide"/>
<booleanAttribute key="run_in_ui_thread" value="false"/>
<setAttribute key="selected_target_bundles">
<setEntry value="ca.uhn.hapi.osgi-base@default:default"/>
<setEntry value="ch.qos.logback.classic@default:default"/>
<setEntry value="ch.qos.logback.core@default:default"/>
<setEntry value="ch.qos.logback.slf4j@default:false"/>
<setEntry value="com.eclipsesource.jaxrs.consumer@default:default"/>
<setEntry value="com.eclipsesource.jaxrs.jersey-all-nojavax@default:default"/>
<setEntry value="com.google.gson@default:default"/>
<setEntry value="com.google.guava@default:default"/>
<setEntry value="com.healthmarketscience.jackcess@default:default"/>
<setEntry value="com.ibm.icu@default:default"/>
<setEntry value="com.mysql.cj@default:default"/>
<setEntry value="com.sun.activation.javax.activation@default:default"/>
<setEntry value="jakarta.persistence@default:default"/>
<setEntry value="jakarta.xml.soap-api@default:default"/>
<setEntry value="jakarta.xml.ws-api@default:default"/>
<setEntry value="javax.el@default:default"/>
<setEntry value="javax.enterprise.cdi-api@default:default"/>
<setEntry value="javax.inject@default:default"/>
<setEntry value="javax.interceptor-api@default:default"/>
<setEntry value="javax.servlet@default:default"/>
<setEntry value="javax.transaction-api@default:default"/>
<setEntry value="javax.transaction.jta@default:default"/>
<setEntry value="javax.xml.stream.stax-api@default:default"/>
<setEntry value="javax.xml@1:default"/>
<setEntry value="jaxb-api@default:default"/>
......@@ -65,13 +71,19 @@
<setEntry value="org.apache.commons.collections4@default:default"/>
<setEntry value="org.apache.commons.collections@default:default"/>
<setEntry value="org.apache.commons.dbcp@default:default"/>
<setEntry value="org.apache.commons.io*2.5.0@default:default"/>
<setEntry value="org.apache.commons.io*2.6.0.v20190123-2029@default:default"/>
<setEntry value="org.apache.commons.lang3@default:default"/>
<setEntry value="org.apache.commons.lang@default:default"/>
<setEntry value="org.apache.commons.logging@default:default"/>
<setEntry value="org.apache.commons.pool@default:default"/>
<setEntry value="org.apache.felix.scr@1:true"/>
<setEntry value="org.apache.poi.ooxml.schemas@default:default"/>
<setEntry value="org.apache.poi.ooxml@default:default"/>
<setEntry value="org.apache.poi@default:default"/>
<setEntry value="org.apache.xmlbeans@default:default"/>
<setEntry value="org.beanshell.bsh@default:default"/>
<setEntry value="org.bouncycastle.bcprov@default:default"/>
<setEntry value="org.dom4j@default:default"/>
<setEntry value="org.eclipse.ant.core@default:default"/>
<setEntry value="org.eclipse.core.contenttype@default:default"/>
<setEntry value="org.eclipse.core.expressions@default:default"/>
......@@ -107,10 +119,12 @@
<setEntry value="org.junit@default:default"/>
<setEntry value="org.postgresql.jdbc42@default:default"/>
<setEntry value="org.slf4j.api@default:default"/>
<setEntry value="org.slf4j.nop@default:false"/>
<setEntry value="osgi.enterprise@1:default"/>
</setAttribute>
<setAttribute key="selected_workspace_bundles">
<setEntry value="ch.elexis.core.hl7.v2x.tests@default:false"/>
<setEntry value="ch.elexis.core.hl7.v2x@default:default"/>
<setEntry value="ch.elexis.core.importer.div@default:default"/>
<setEntry value="ch.elexis.core.jcifs.test@default:false"/>
<setEntry value="ch.elexis.core.jcifs@default:default"/>
<setEntry value="ch.elexis.core.jpa.datasource@3:true"/>
......@@ -120,18 +134,21 @@
<setEntry value="ch.elexis.core.jpa.test@default:false"/>
<setEntry value="ch.elexis.core.jpa@default:false"/>
<setEntry value="ch.elexis.core.l10n@default:default"/>
<setEntry value="ch.elexis.core.logback.rocketchat@default:default"/>
<setEntry value="ch.elexis.core.logback.rocketchat@default:false"/>
<setEntry value="ch.elexis.core.logging.default_configuration@default:false"/>
<setEntry value="ch.elexis.core.model.test@default:false"/>
<setEntry value="ch.elexis.core.model@default:true"/>
<setEntry value="ch.elexis.core.services.test@default:false"/>
<setEntry value="ch.elexis.core.services@default:default"/>
<setEntry value="ch.elexis.core.test.context@default:default"/>
<setEntry value="ch.elexis.core.tasks.test@default:false"/>
<setEntry value="ch.elexis.core.tasks@default:default"/>
<setEntry value="ch.elexis.core.test.context@default:false"/>
<setEntry value="ch.elexis.core.test@default:default"/>
<setEntry value="ch.elexis.core@default:default"/>
<setEntry value="ch.rgw.utility.tests@default:false"/>
<setEntry value="ch.rgw.utility@default:default"/>
<setEntry value="jaxb-api-impl-import-java9@default:default"/>
<setEntry value="jaxb-api-impl-import-java9@default:false"/>
<setEntry value="org.osgi.framework.system.packages.extra@default:false"/>
</setAttribute>
<booleanAttribute key="show_selected_only" value="false"/>
<booleanAttribute key="tracing" value="false"/>
......
......@@ -29,7 +29,8 @@ public class LabMappingTest {
@Before
public void before(){
modelService = OsgiServiceUtil.getService(IModelService.class).get();
modelService = OsgiServiceUtil.getService(IModelService.class,
"(" + IModelService.SERVICEMODELNAME + "=ch.elexis.core.model)").get();
item1 = modelService.create(ILabItem.class);
item1.setCode("testItem1");
......
......@@ -19,7 +19,7 @@ import ch.elexis.core.types.LabItemTyp;
import ch.elexis.core.utils.OsgiServiceUtil;
public class LabOrderTest {
private IModelService modelSerice;
private IModelService modelService;
private IPatient patient1;
private IPatient patient2;
......@@ -31,26 +31,27 @@ public class LabOrderTest {
@Before
public void before(){
modelSerice = OsgiServiceUtil.getService(IModelService.class).get();
modelService = OsgiServiceUtil.getService(IModelService.class,
"(" + IModelService.SERVICEMODELNAME + "=ch.elexis.core.model)").get();
patient1 = modelSerice.create(IPatient.class);
patient1 = modelService.create(IPatient.class);
patient1.setDescription1("test patient 1");
modelSerice.save(patient1);
patient2 = modelSerice.create(IPatient.class);
modelService.save(patient1);
patient2 = modelService.create(IPatient.class);
patient2.setDescription1("test patient 2");
modelSerice.save(patient2);
item1 = modelSerice.create(ILabItem.class);
modelService.save(patient2);
item1 = modelService.create(ILabItem.class);
item1.setCode("testItem");
item1.setName("test item name");
item1.setReferenceFemale("<25");
item1.setReferenceMale("<30");
item1.setTyp(LabItemTyp.NUMERIC);
modelSerice.save(item1);
result1 = modelSerice.create(ILabResult.class);
modelService.save(item1);
result1 = modelService.create(ILabResult.class);
result1.setItem(item1);
result1.setPatient(patient1);
result1.setResult("result 1");
result2 = modelSerice.create(ILabResult.class);
result2 = modelService.create(ILabResult.class);
result2.setItem(item1);
result2.setPatient(patient2);
result2.setResult("result 2");
......@@ -58,28 +59,28 @@ public class LabOrderTest {
@After
public void after(){
modelSerice.remove(patient1);
modelSerice.remove(patient2);
modelSerice.remove(item1);
modelSerice.remove(result1);
modelSerice.remove(result2);
modelService.remove(patient1);
modelService.remove(patient2);
modelService.remove(item1);
modelService.remove(result1);
modelService.remove(result2);
OsgiServiceUtil.ungetService(modelSerice);
modelSerice = null;
OsgiServiceUtil.ungetService(modelService);
modelService = null;
}
@Test
public void create(){
ILabOrder order = modelSerice.create(ILabOrder.class);
ILabOrder order = modelService.create(ILabOrder.class);
assertNotNull(order);
assertTrue(order instanceof ILabOrder);
order.setItem(item1);
order.setPatient(patient1);
order.setState(LabOrderState.ORDERED);
assertTrue(modelSerice.save(order));
assertTrue(modelService.save(order));
assertNotNull(order.getOrderId());
Optional<ILabOrder> loadedOrder = modelSerice.load(order.getId(), ILabOrder.class);
Optional<ILabOrder> loadedOrder = modelService.load(order.getId(), ILabOrder.class);
assertTrue(loadedOrder.isPresent());
assertFalse(order == loadedOrder.get());
assertEquals(order, loadedOrder.get());
......@@ -87,38 +88,38 @@ public class LabOrderTest {
assertEquals(order.getPatient(), loadedOrder.get().getPatient());
assertEquals(order.getState(), loadedOrder.get().getState());
ILabOrder order1 = modelSerice.create(ILabOrder.class);
ILabOrder order1 = modelService.create(ILabOrder.class);
order.setItem(item1);
order.setPatient(patient1);
assertTrue(modelSerice.save(order1));
assertTrue(modelService.save(order1));
assertEquals(1,
Integer.parseInt(order1.getOrderId()) - Integer.parseInt(order.getOrderId()));
modelSerice.remove(order);
modelService.remove(order);
}
@Test
public void query(){
ILabOrder order1 = modelSerice.create(ILabOrder.class);
ILabOrder order1 = modelService.create(ILabOrder.class);
order1.setItem(item1);
order1.setPatient(patient1);
order1.setResult(result1);
assertTrue(modelSerice.save(order1));
assertTrue(modelService.save(order1));
ILabOrder order2 = modelSerice.create(ILabOrder.class);
ILabOrder order2 = modelService.create(ILabOrder.class);
order2.setItem(item1);
order2.setPatient(patient2);
order2.setResult(result2);
assertTrue(modelSerice.save(order2));
assertTrue(modelService.save(order2));
IQuery<ILabOrder> query = modelSerice.getQuery(ILabOrder.class);
IQuery<ILabOrder> query = modelService.getQuery(ILabOrder.class);
query.and(ModelPackage.Literals.ILAB_ORDER__ITEM, COMPARATOR.EQUALS, item1);
List<ILabOrder> existing = query.execute();
assertNotNull(existing);
assertFalse(existing.isEmpty());
assertEquals(2, existing.size());
query = modelSerice.getQuery(ILabOrder.class);
query = modelService.getQuery(ILabOrder.class);
query.and(ModelPackage.Literals.ILAB_ORDER__PATIENT, COMPARATOR.EQUALS, patient2);
existing = query.execute();
assertNotNull(existing);
......@@ -131,7 +132,7 @@ public class LabOrderTest {
// test query via result
assertEquals(order1, result1.getLabOrder());
modelSerice.remove(order1);
modelSerice.remove(order2);
modelService.remove(order1);
modelService.remove(order2);
}
}
......@@ -20,7 +20,7 @@ import ch.elexis.core.types.LabItemTyp;
import ch.elexis.core.utils.OsgiServiceUtil;
public class LabResultTest {
private IModelService modelSerice;
private IModelService modelService;
private IPatient patient1;
private IPatient patient2;
......@@ -29,36 +29,37 @@ public class LabResultTest {
@Before
public void before(){
modelSerice = OsgiServiceUtil.getService(IModelService.class).get();
modelService = OsgiServiceUtil.getService(IModelService.class,
"(" + IModelService.SERVICEMODELNAME + "=ch.elexis.core.model)").get();
patient1 = modelSerice.create(IPatient.class);
patient1 = modelService.create(IPatient.class);
patient1.setDescription1("test patient 1");
modelSerice.save(patient1);
patient2 = modelSerice.create(IPatient.class);
modelService.save(patient1);
patient2 = modelService.create(IPatient.class);
patient2.setDescription1("test patient 2");
modelSerice.save(patient2);
item1 = modelSerice.create(ILabItem.class);
modelService.save(patient2);
item1 = modelService.create(ILabItem.class);
item1.setCode("testItem");
item1.setName("test item name");
item1.setReferenceFemale("<25");
item1.setReferenceMale("<30");
item1.setTyp(LabItemTyp.NUMERIC);
modelSerice.save(item1);
modelService.save(item1);
}
@After
public void after(){
modelSerice.remove(patient1);
modelSerice.remove(patient2);
modelSerice.remove(item1);
modelService.remove(patient1);
modelService.remove(patient2);
modelService.remove(item1);
OsgiServiceUtil.ungetService(modelSerice);
modelSerice = null;
OsgiServiceUtil.ungetService(modelService);
modelService = null;
}
@Test
public void create(){
ILabResult result = modelSerice.create(ILabResult.class);
ILabResult result = modelService.create(ILabResult.class);
assertNotNull(result);
assertTrue(result instanceof ILabResult);
......@@ -68,9 +69,9 @@ public class LabResultTest {
result.setReferenceMale("<30");
result.setResult("22.56");
result.setExtInfo("testInfo", "testInfo");
assertTrue(modelSerice.save(result));
assertTrue(modelService.save(result));
Optional<ILabResult> loadedResult = modelSerice.load(result.getId(), ILabResult.class);
Optional<ILabResult> loadedResult = modelService.load(result.getId(), ILabResult.class);
assertTrue(loadedResult.isPresent());
assertFalse(result == loadedResult.get());
assertEquals(result, loadedResult.get());
......@@ -80,37 +81,37 @@ public class LabResultTest {
assertEquals(result.getResult(), loadedResult.get().getResult());
assertEquals(result.getExtInfo("testInfo"), loadedResult.get().getExtInfo("testInfo"));
modelSerice.remove(result);
modelService.remove(result);
}
@Test
public void query(){
ILabResult result1 = modelSerice.create(ILabResult.class);
ILabResult result1 = modelService.create(ILabResult.class);
result1.setPatient(patient1);
result1.setItem(item1);
result1.setReferenceFemale("<25");
result1.setReferenceMale("<30");
result1.setResult("22.56");
result1.setObservationTime(LocalDateTime.of(2018, 1, 1, 10, 0));
assertTrue(modelSerice.save(result1));
assertTrue(modelService.save(result1));
ILabResult result2 = modelSerice.create(ILabResult.class);
ILabResult result2 = modelService.create(ILabResult.class);
result2.setPatient(patient2);
result2.setItem(item1);
result2.setReferenceFemale("<25");
result2.setReferenceMale("<30");
result2.setResult("35.85");
result2.setObservationTime(LocalDateTime.of(2018, 1, 2, 15, 0));
assertTrue(modelSerice.save(result2));
assertTrue(modelService.save(result2));
IQuery<ILabResult> query = modelSerice.getQuery(ILabResult.class);
IQuery<ILabResult> query = modelService.getQuery(ILabResult.class);
query.and(ModelPackage.Literals.ILAB_RESULT__ITEM, COMPARATOR.EQUALS, item1);
List<ILabResult> existing = query.execute();
assertNotNull(existing);
assertFalse(existing.isEmpty());
assertEquals(2, existing.size());
query = modelSerice.getQuery(ILabResult.class);
query = modelService.getQuery(ILabResult.class);
query.and(ModelPackage.Literals.ILAB_RESULT__PATIENT, COMPARATOR.EQUALS, patient1);
existing = query.execute();
assertNotNull(existing);
......@@ -119,7 +120,7 @@ public class LabResultTest {
assertFalse(result1 == existing.get(0));
assertEquals(result1, existing.get(0));
query = modelSerice.getQuery(ILabResult.class);
query = modelService.getQuery(ILabResult.class);
query.and(ModelPackage.Literals.ILAB_RESULT__PATIENT, COMPARATOR.EQUALS, patient2);
query.and(ModelPackage.Literals.ILAB_RESULT__OBSERVATION_TIME, COMPARATOR.GREATER,
LocalDateTime.of(2018, 1, 2, 13, 0));
......@@ -131,7 +132,7 @@ public class LabResultTest {
assertEquals(result2, existing.get(0));
assertEquals(result2.getObservationTime(), existing.get(0).getObservationTime());
modelSerice.remove(result1);
modelSerice.remove(result2);
modelService.remove(result1);
modelService.remove(result2);
}
}
......@@ -18,52 +18,53 @@ import ch.elexis.core.services.IQuery.COMPARATOR;
import ch.elexis.core.utils.OsgiServiceUtil;
public class LaboratoryTest {
private IModelService modelSerice;
private IModelService modelService;
@Before
public void before(){
modelSerice = OsgiServiceUtil.getService(IModelService.class).get();
modelService = OsgiServiceUtil.getService(IModelService.class,
"(" + IModelService.SERVICEMODELNAME + "=ch.elexis.core.model)").get();
}
@After
public void after(){
OsgiServiceUtil.ungetService(modelSerice);
modelSerice = null;
OsgiServiceUtil.ungetService(modelService);
modelService = null;
}
@Test
public void create(){
ILaboratory laboratory = modelSerice.create(ILaboratory.class);
ILaboratory laboratory = modelService.create(ILaboratory.class);
assertNotNull(laboratory);
assertTrue(laboratory instanceof ILaboratory);
laboratory.setCode("TestLab");
laboratory.setDescription1("Laboratory Test");
assertTrue(modelSerice.save(laboratory));
assertTrue(modelService.save(laboratory));
Optional<ILaboratory> loadedLaboratory =
modelSerice.load(laboratory.getId(), ILaboratory.class);
modelService.load(laboratory.getId(), ILaboratory.class);
assertTrue(loadedLaboratory.isPresent());
assertFalse(laboratory == loadedLaboratory.get());
assertEquals(laboratory, loadedLaboratory.get());
assertEquals(laboratory.getCode(), loadedLaboratory.get().getCode());
assertEquals(laboratory.getDescription1(), loadedLaboratory.get().getDescription1());
modelSerice.remove(laboratory);
modelService.remove(laboratory);
}
@Test
public void query(){
ILaboratory laboratory1 = modelSerice.create(ILaboratory.class);
ILaboratory laboratory1 = modelService.create(ILaboratory.class);
laboratory1.setCode("TestLab1");
laboratory1.setDescription1("Laboratory Test 1");
modelSerice.save(laboratory1);
ILaboratory laboratory2 = modelSerice.create(ILaboratory.class);
modelService.save(laboratory1);
ILaboratory laboratory2 = modelService.create(ILaboratory.class);
laboratory2.setCode("TestLab2");
laboratory2.setDescription1("Laboratory Test 2");
modelSerice.save(laboratory2);
modelService.save(laboratory2);
IQuery<ILaboratory> query = modelSerice.getQuery(ILaboratory.class);
IQuery<ILaboratory> query = modelService.getQuery(ILaboratory.class);
query.startGroup();
query.or(ModelPackage.Literals.ICONTACT__CODE, COMPARATOR.LIKE, "%TestLab%");
query.or(ModelPackage.Literals.ICONTACT__DESCRIPTION1, COMPARATOR.LIKE, "%TestLab%");
......@@ -72,7 +73,7 @@ public class LaboratoryTest {
assertFalse(existing.isEmpty());
assertEquals(2, existing.size());
query = modelSerice.getQuery(ILaboratory.class);
query = modelService.getQuery(ILaboratory.class);
query.startGroup();
query.or(ModelPackage.Literals.ICONTACT__CODE, COMPARATOR.LIKE, "%Lab1%");
query.or(ModelPackage.Literals.ICONTACT__DESCRIPTION1, COMPARATOR.LIKE, "%Lab1%");
......@@ -83,7 +84,7 @@ public class LaboratoryTest {
assertEquals(laboratory1.getCode(), existing.get(0).getCode());
assertEquals(laboratory1.getDescription1(), existing.get(0).getDescription1());
modelSerice.remove(laboratory1);
modelSerice.remove(laboratory2);
modelService.remove(laboratory1);
modelService.remove(laboratory2);
}
}
......@@ -22,7 +22,7 @@ import ch.elexis.core.types.ArticleTyp;
import ch.elexis.core.utils.OsgiServiceUtil;
public class OrderEntryTest {
private IModelService modelSerice;
private IModelService modelService;
private IArticle article, article1;
......@@ -34,53 +34,54 @@ public class OrderEntryTest {
@Before
public void before(){
modelSerice = OsgiServiceUtil.getService(IModelService.class).get();
modelService = OsgiServiceUtil.getService(IModelService.class,
"(" + IModelService.SERVICEMODELNAME + "=ch.elexis.core.model)").get();
article = modelSerice.create(IArticle.class);
article = modelService.create(IArticle.class);
article.setName("test article");
article.setCode("123456789");
article.setTyp(ArticleTyp.EIGENARTIKEL);
article.setGtin("0000001111111");
article.setPackageSize(12);
article.setSellingSize(12);
modelSerice.save(article);
modelService.save(article);
article1 = modelSerice.create(IArticle.class);
article1 = modelService.create(IArticle.class);
article1.setName("test article 1");
article1.setCode("987654321");
article1.setTyp(ArticleTyp.EIGENARTIKEL);
article1.setGtin("1111112222222");
article1.setPackageSize(24);
article1.setSellingSize(24);
modelSerice.save(article1);
modelService.save(article1);
stock = modelSerice.create(IStock.class);
stock = modelService.create(IStock.class);
stock.setCode("TST");
stock.setPriority(5);
modelSerice.save(stock);
modelService.save(stock);
orderTimestamp = LocalDateTime.now();
order = modelSerice.create(IOrder.class);
order = modelService.create(IOrder.class);
order.setTimestamp(orderTimestamp);
order.setName("TEST");
modelSerice.save(order);
modelService.save(order);
}
@After
public void after(){
modelSerice.remove(order);
modelSerice.remove(article);
modelSerice.remove(article1);
modelSerice.remove(stock);
modelService.remove(order);
modelService.remove(article);
modelService.remove(article1);
modelService.remove(stock);
OsgiServiceUtil.ungetService(modelSerice);
modelSerice = null;
OsgiServiceUtil.ungetService(modelService);
modelService = null;
}
@Test
public void create(){
IOrderEntry entry = modelSerice.create(IOrderEntry.class);
IOrderEntry entry = modelService.create(IOrderEntry.class);
assertNotNull(entry);
assertTrue(entry instanceof IOrderEntry);
......@@ -88,10 +89,10 @@ public class OrderEntryTest {
entry.setStock(stock);
entry.setArticle(article);
entry.setAmount(5);
modelSerice.save(entry);
modelService.save(entry);
assertFalse(order.getEntries().isEmpty());
Optional<IOrderEntry> loaded = modelSerice.load(entry.getId(), IOrderEntry.class);
Optional<IOrderEntry> loaded = modelService.load(entry.getId(), IOrderEntry.class);
assertTrue(loaded.isPresent());
assertFalse(entry == loaded.get());
assertEquals(entry, loaded.get());
......@@ -100,12 +101,12 @@ public class OrderEntryTest {
assertEquals(entry.getOrder(), loaded.get().getOrder());
assertEquals(entry.getOrder().getTimestamp(), loaded.get().getOrder().getTimestamp());
IOrderEntry entry2 = modelSerice.create(IOrderEntry.class);
IOrderEntry entry2 = modelService.create(IOrderEntry.class);
entry2.setStock(stock);
entry2.setArticle(article1);
entry2.setAmount(1);
order.addEntry(entry2);
modelSerice.save(order);
modelService.save(order);
assertEquals(2, order.getEntries().size());
order.removeEntry(entry);
......@@ -115,24 +116,24 @@ public class OrderEntryTest {
@Test
public void query(){
IOrderEntry entry = modelSerice.create(IOrderEntry.class);
IOrderEntry entry = modelService.create(IOrderEntry.class);
entry.setOrder(order);
entry.setStock(stock);
entry.setArticle(article);
entry.setAmount(5);
modelSerice.save(entry);
modelService.save(entry);
IOrderEntry entry1 = modelSerice.create(IOrderEntry.class);
IOrderEntry entry1 = modelService.create(IOrderEntry.class);
entry1.setOrder(order);
entry1.setStock(stock);
entry1.setArticle(article1);
entry1.setAmount(2);
modelSerice.save(entry1);
modelService.save(entry1);
String storeToString = StoreToStringServiceHolder.getStoreToString(article);
String[] articleParts = storeToString.split(IStoreToStringContribution.DOUBLECOLON);
IQuery<IOrderEntry> query = modelSerice.getQuery(IOrderEntry.class, true, false);
IQuery<IOrderEntry> query = modelService.getQuery(IOrderEntry.class, true, false);
query.and("articleId", COMPARATOR.EQUALS, articleParts[1]);
query.and("articleType", COMPARATOR.EQUALS, articleParts[0]);
List<IOrderEntry> existing = query.execute();
......
......@@ -12,7 +12,6 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import ch.elexis.core.model.test.CoreModelServiceHolder;
import ch.elexis.core.model.test.StoreToStringServiceHolder;
import ch.elexis.core.services.IModelService;
import ch.elexis.core.services.INamedQuery;
......@@ -31,7 +30,8 @@ public class StockEntryTest {
@Before
public void before(){
modelService = OsgiServiceUtil.getService(IModelService.class).get();
modelService = OsgiServiceUtil.getService(IModelService.class,
"(" + IModelService.SERVICEMODELNAME + "=ch.elexis.core.model)").get();
article = modelService.create(IArticle.class);
article.setName("test article");
......@@ -114,7 +114,7 @@ public class StockEntryTest {
List<IStockEntry> existing = query.execute();
assertEquals(2, existing.size());
INamedQuery<Long> currentStock = CoreModelServiceHolder.get().getNamedQueryByName(
INamedQuery<Long> currentStock = modelService.getNamedQueryByName(
Long.class, IStockEntry.class, "StockEntry_SumCurrentStock.articleId.articleType");
String storeToString = StoreToStringServiceHolder.getStoreToString(article);
String[] parts = storeToString.split(IStoreToStringContribution.DOUBLECOLON);
......