Skip to content

Commit 78b9cdc

Browse files
committed
Loading Mechanism: unit tests improved for batch requests
1 parent f03de15 commit 78b9cdc

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/test/java/org/geppetto/datasources/DataSourcesGeppettoManagerTest.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,13 @@ public void test05LoadExperiment() throws GeppettoExecutionException, GeppettoAc
184184
@Test
185185
public void test06FetchVariable() throws GeppettoExecutionException, GeppettoAccessException, GeppettoDataSourceException, GeppettoModelException
186186
{
187-
String[] idsList = {"testVariable"};
187+
// the duplicates are intentional, the RunTimeProject class will check if duplicates want to be fetched or if they are already in the current model.
188+
String[] idsList = {"testVariable", "testVariable", "testVariable2", "testVariable2", "testVariable"};
188189
GeppettoModel geppettoModel = runtimeProject.getGeppettoModel();
189190
Assert.assertEquals(1, geppettoModel.getVariables().size()); // only "time" //FIXME Should time be there without a simulation?
190191
GeppettoModel model = manager.fetchVariable("testDataSource", idsList, geppettoProject);
191192
Assert.assertEquals("testVariable", model.getVariables().get(1).getId());
193+
Assert.assertEquals("testVariable2", model.getVariables().get(2).getId());
192194
}
193195

194196
/**
@@ -202,15 +204,15 @@ public void test07ResolveImportType() throws GeppettoExecutionException, Geppett
202204
{
203205
GeppettoModel geppettoModel = runtimeProject.getGeppettoModel();
204206
Type type = geppettoModel.getLibraries().get(0).getTypes().get(0);
205-
Assert.assertEquals(1, geppettoModel.getLibraries().get(0).getTypes().size());
207+
Assert.assertEquals(2, geppettoModel.getLibraries().get(0).getTypes().size());
206208
Assert.assertEquals("testImportType", type.getId());
207209
Assert.assertTrue(type instanceof ImportType);
208210
List<String> types=new ArrayList<String>();
209211
types.add("testLibrary.testImportType");
210212
GeppettoModel model = manager.resolveImportType(types, geppettoProject);
211-
type = model.getLibraries().get(0).getTypes().get(0);
213+
type = model.getLibraries().get(0).getTypes().get(1);
212214
Assert.assertTrue(type instanceof CompositeType);
213-
Assert.assertEquals(1, model.getLibraries().get(0).getTypes().size()); //still only one type but this time it's a composite
215+
Assert.assertEquals(2, model.getLibraries().get(0).getTypes().size()); //still only one type but this time it's a composite
214216
Assert.assertEquals(5, ((CompositeType) type).getVariables().size());
215217

216218
}

0 commit comments

Comments
 (0)