1package denoptim.integration.rcoserver;
4import static org.junit.jupiter.api.Assertions.assertEquals;
5import static org.junit.jupiter.api.Assertions.assertFalse;
6import static org.junit.jupiter.api.Assertions.assertTrue;
8import java.util.HashMap;
11import org.junit.jupiter.api.Test;
13import com.google.gson.JsonArray;
14import com.google.gson.JsonElement;
15import com.google.gson.JsonObject;
17import denoptim.molecularmodeling.zmatrix.ZMatrix;
18import denoptim.molecularmodeling.zmatrix.ZMatrixAtom;
38 0,
"H",
"H.1",
null,
null,
null,
39 null,
null,
null,
null);
42 1,
"O",
"O.2", atom0,
null,
null,
43 1.5,
null,
null,
null);
46 2,
"C",
"C.3", atom1, atom0,
null,
47 1.4, 109.5,
null,
null);
50 3,
"H",
"H.1", atom2, atom1, atom0,
54 4,
"H",
"H.1", atom2, atom1, atom3,
55 1.4, 109.5, 109.0, 1);
58 5,
"H",
"H.1", atom4, atom2, atom1,
77 assertEquals(6, result.size());
79 Map<String,Integer> expectedNotNullFrom =
new HashMap<String,Integer>();
80 expectedNotNullFrom.put(
"id", 0);
81 expectedNotNullFrom.put(
"element", 0);
82 expectedNotNullFrom.put(
"bond_ref", 1);
83 expectedNotNullFrom.put(
"bond_length", 1);
84 expectedNotNullFrom.put(
"angle_ref", 2);
85 expectedNotNullFrom.put(
"angle", 2);
86 expectedNotNullFrom.put(
"dihedral_ref", 3);
87 expectedNotNullFrom.put(
"dihedral", 3);
88 expectedNotNullFrom.put(
"chirality", 3);
91 for (JsonElement je : result.asList())
93 JsonObject jo = je.getAsJsonObject();
94 for (String key : expectedNotNullFrom.keySet())
96 if (idx >= expectedNotNullFrom.get(key))
98 assertTrue(jo.has(key),
"Missing key '" + key +
"' in " + jo);
99 assertFalse(jo.get(key).isJsonNull(),
"JsonNull for '" + key +
"': " + jo);
101 assertFalse(jo.has(key),
"Unexpected key '" + key +
"' in " + jo);
Sends the request to produce a socket server running the RingClosingMM service.
static JsonArray getZMatrixAsJsonArray(ZMatrix zmat)
Gets a JsonArray representation of the Z-matrix.
Unit test for RCOSocketServerClient.
void testGetZMatrixAsJsonArray()
Representation of an atom in the ZMatrix.
Representation of an atom container's geometry with internal coordinates.
void addBond(int a1, int a2)
Add a bond between the two atoms at the given indices.
void addAtom(ZMatrixAtom atom)
Add an atom to the ZMatrix.