Skip to content

Commit

Permalink
Move microservice WAMP test from MDStudio/tests to package
Browse files Browse the repository at this point in the history
  • Loading branch information
marcvdijk committed Jun 14, 2018
1 parent 25d6434 commit 5f8e6b5
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 0 deletions.
50 changes: 50 additions & 0 deletions tests/wamp_test/files/structure.mol2
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
@<TRIPOS>MOLECULE
ligand
21 21 0 0 0
SMALL
GASTEIGER

@<TRIPOS>ATOM
1 O -0.5471 -1.0180 0.3433 O.3 1 LIG11 -0.4613
2 C 0.8785 -1.0224 0.2270 C.3 1 LIG11 0.1036
3 H 1.2914 -1.5214 1.1112 H 1 LIG11 0.0734
4 C 1.2911 0.4358 0.2226 C.3 1 LIG11 -0.0056
5 C 0.0674 1.1651 -0.2725 C.3 1 LIG11 0.0483
6 C -1.0428 0.2213 0.0666 C.2 1 LIG11 0.3075
7 O -2.2294 0.5000 0.0615 O.2 1 LIG11 -0.2508
8 C 1.3167 -1.7790 -1.0313 C.3 1 LIG11 -0.0159
9 C 0.8755 -3.2458 -0.9950 C.3 1 LIG11 -0.0526
10 C 1.5208 -4.0539 -2.1102 C.3 1 LIG11 -0.0652
11 H 2.1837 0.6440 -0.3752 H 1 LIG11 0.0306
12 H 1.5085 0.7543 1.2497 H 1 LIG11 0.0306
13 H 0.0921 1.3157 -1.3549 H 1 LIG11 0.0379
14 H -0.0623 2.1187 0.2457 H 1 LIG11 0.0379
15 H 2.4088 -1.7257 -1.1182 H 1 LIG11 0.0301
16 H 0.8915 -1.3085 -1.9265 H 1 LIG11 0.0301
17 H -0.2148 -3.3087 -1.0892 H 1 LIG11 0.0264
18 H 1.1445 -3.6961 -0.0325 H 1 LIG11 0.0264
19 H 1.2769 -3.6384 -3.0927 H 1 LIG11 0.0230
20 H 1.1684 -5.0899 -2.0799 H 1 LIG11 0.0230
21 H 2.6104 -4.0662 -2.0021 H 1 LIG11 0.0230
@<TRIPOS>BOND
1 1 2 1
2 2 3 1
3 2 4 1
4 4 5 1
5 5 6 1
6 1 6 1
7 6 7 2
8 2 8 1
9 8 9 1
10 9 10 1
11 4 11 1
12 4 12 1
13 5 13 1
14 5 14 1
15 8 15 1
16 8 16 1
17 9 17 1
18 9 18 1
19 10 19 1
20 10 20 1
21 10 21 1
5 changes: 5 additions & 0 deletions tests/wamp_test/settings.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
session:
username: mdadmin
password: this_should_be_replaced_for_production!@#$%^&*()_+1234567890-=
settings:
printInEndpoint: false
62 changes: 62 additions & 0 deletions tests/wamp_test/test_lie_atb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
from mdstudio.deferred.chainable import chainable
from mdstudio.component.session import ComponentSession
from mdstudio.runner import main
from os.path import join
import os
import shutil

file_path = os.path.realpath(__file__)
root = os.path.split(file_path)[0]


def create_workdir(name, path="/tmp/mdstudio/lie_atb"):
"""Create temporal workdir dir"""
workdir = join(path, name)
if not os.path.isdir(workdir):
os.makedirs(workdir)
return workdir


def copy_to_workdir(file_path, workdir):
shutil.copy(file_path, workdir)
base = os.path.basename(file_path)
return join(workdir, base)


workdir = create_workdir("lie_atb")
path_mol = copy_to_workdir(
join(root, "files/structure.mol2"), workdir)

dict_query = {
"netcharge": 0,
"dim": 3,
"exactmass": 128.083729624,
"title": "ligand",
"PartialCharges": "GASTEIGER",
"energy": 0.0,
"molwt": 128.16898000000003,
"structure_format": "mol2",
"mol": path_mol,
"formula": "C7H12O2",
"isfile": True,
"workdir": workdir
}


class Run_atb(ComponentSession):

def authorize_request(self, uri, claims):
return True

@chainable
def on_run(self):
with self.group_context('mdgroup'):

result_collect = yield self.call(
"mdgroup.lie_atb.endpoint.structure_query",
dict_query)
print(result_collect)


if __name__ == "__main__":
main(Run_atb)

0 comments on commit 5f8e6b5

Please sign in to comment.