Skip to content

Commit 43b0ac0

Browse files
committed
Structural sites: database write / read roundtrip test
1 parent 213304c commit 43b0ac0

2 files changed

Lines changed: 1111 additions & 4 deletions

File tree

vcell-server/src/test/java/cbit/vcell/modeldb/SpeciesContextSpecTableTest.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public class SpeciesContextSpecTableTest {
5656
public void test_springsalad_application() throws IOException, XmlParseException, PropertyVetoException, ExpressionException, GeometryException,
5757
ImageException, IllegalMappingException, MappingException, SolverException {
5858

59-
BioModel bioModel = getBioModelFromResource("Spring_application.vcml");
59+
BioModel bioModel = getBioModelFromResource("Spring_application2.vcml");
6060
SimulationContext simContext = bioModel.getSimulationContext(0);
6161

6262
// WARNING!! Debug configuration for this JUnit test required System property "vcell.installDir"
@@ -65,11 +65,14 @@ public void test_springsalad_application() throws IOException, XmlParseException
6565
assertTrue((mathDescription.getMathType() != null && mathDescription.getMathType() == SpringSaLaD) ? true : false, "expecting SpringSaLaD math type");
6666

6767
SpeciesContextSpec[] speciesContextSpecs = simContext.getReactionContext().getSpeciesContextSpecs();
68-
SpeciesContextSpec scs = speciesContextSpecs[0]; // we test roundtrip for just one SpeciesContextSpec
68+
SpeciesContextSpec scs = speciesContextSpecs[1]; // we test roundtrip for just one SpeciesContextSpec
6969
String internalLinkSetSQL = SpeciesContextSpecTable.getInternalLinksSQL(scs);
7070
String siteAttributesMapSQL = SpeciesContextSpecTable.getSiteAttributesSQL(scs);
71-
Set<MolecularInternalLinkSpec> internalLinkSet = SpeciesContextSpecTable.readInternalLinksSQL(scs, internalLinkSetSQL);
71+
String structuralSiteAttributesMapSQL = SpeciesContextSpecTable.getStructuralSiteAttributesSQL(scs);
72+
7273
Map<MolecularComponentPattern, SiteAttributesSpec> siteAttributesMap = SpeciesContextSpecTable.readSiteAttributesSQL(scs, siteAttributesMapSQL);
74+
Map<StructuralSite, SiteAttributesSpec> structuralSiteAttributesMap = SpeciesContextSpecTable.readStructuralSiteAttributesSQL(scs, structuralSiteAttributesMapSQL);
75+
Set<MolecularInternalLinkSpec> internalLinkSet = SpeciesContextSpecTable.readInternalLinksSQL(scs, internalLinkSetSQL);
7376

7477
double bondLength = 1;
7578
Map<ReactionRuleSpec.Subtype, Integer> subTypeMap = new LinkedHashMap<>();
@@ -111,8 +114,14 @@ public void test_springsalad_application() throws IOException, XmlParseException
111114
SiteAttributesSpec sasThis = siteAttributesMap.get(mcpThis);
112115
SiteAttributesSpec sasThat = scs.getSiteAttributesMap().get(mcpThis);
113116
assertTrue(sasThis.compareEqual(sasThat) ? true : false, "SiteAttributesSpec element not found in siteAttributesMap after roundtrip");
114-
}
115117

118+
// verify roundtrip for structuralSiteAttributesMap (through sampling)
119+
assertTrue(structuralSiteAttributesMap.size() == scs.getStructuralSiteAttributesMap().size() ? true : false, "structuralSiteAttributesMap size different after roundtrip");
120+
StructuralSite ssThis = structuralSiteAttributesMap.keySet().iterator().next();
121+
SiteAttributesSpec ssasThis = structuralSiteAttributesMap.get(ssThis);
122+
SiteAttributesSpec ssasThat = scs.getStructuralSiteAttributesMap().get(ssThis);
123+
assertTrue(ssasThis.compareEqual(ssasThat) ? true : false, "SiteAttributesSpec element not found in structuralSiteAttributesMap after roundtrip");
124+
}
116125

117126
// ==========================================================================================================================
118127

0 commit comments

Comments
 (0)