GithubHelp home page GithubHelp logo

arcadia-mock's Introduction

ARCADIA Mock

wercker status CodeCov Codacy grade License

This is a mock of the ARCADIA services, used for testing the TOSCA Arcadia plugin. It includes a set of REST services that mimics the ARCADIA ones, and a client API that eases integration with Python 2.7.

End-points

In the current version (v0.0.3), requests can specify the type of content they would like to receive in the accept header field.

  • GET /service_graphs, returns the service graphs currently registered.
  • POST /register, submit a new service_graphs. So far XML is expected, as follows:
	 <?xml version="1.0" encoding="UTF-8"?>
	 <ServiceGraph>
		 <DescriptiveSGMetadata>
			<SGID>wordpress_mysql_service_graph_id</SGID>
			<SGName>SimpleWordPressServiceGraph</SGName>
			<SGDescription>SGDescription</SGDescription>
		</DescriptiveSGMetadata>
		<GraphNodeDescriptor>
			<GraphNode>
				<NID>graph_node_mysql_id</NID>
				<CNID>mysql_id</CNID>
			</GraphNode>
			<GraphNode>
				<NID>graph_node_wordpress_id</NID>
				<CNID>wordpress_id</CNID>
				<GraphDependency>
					<CEPCID>mysqltcp_cepcid</CEPCID>
					<ECEPID>mysqltcp</ECEPID>
					<NID>NID</NID>
				</GraphDependency>
			</GraphNode>
		</GraphNodeDescriptor>
		<RuntimePolicyDescriptor>
			<RuntimePolicy>
				<RPID>RPID</RPID>
				<RPName>RPName</RPName>
			</RuntimePolicy>
		</RuntimePolicyDescriptor>
	</ServiceGraph>
  • GET /components returns the list of components registered so far

  • POST /components register a new component, described by an XML snippet as follow:

<Component>
	<CID>1</CID>
	<CNID>2</CNID>
	<CEPNID>3</CEPNID>
	<ECEPCNID>4</ECEPCNID>\
</Component>\
  • GET /about, returns some debug info, such as version number and license.

Installation & Usage

This is a Python 2.7 application. To install it, run the followings commands (assuming you are running Linux-like OS):

$> cd my-working-directory
$> git clone [email protected]:SINTEF-9012/arcadia-mock.git
$> cd arcadiamock
$> pip install .
$> arcadiamock

Note that if you want to develop or modify the code, you may want to install it using the -e option of pip, as:

$> pip install -e .

Testing

ARCADIA mocks comes with a test suite that checks whether its basic functionalities. You can run it with the following commands:

$> tox -e py27

or

$> python setup.py test

In addition, you can measure the code coverage by running this test suite inside the 'coverage' tool.

$> coverage run setup.py test
$> coverage combine
$> coverage report -m

The test suite includes some acceptance tests that take some time to run because they spawn an HTTP server in the background and then request specific pages.

For coverage to account for these integration tests, you must define the environment variable COVERAGE_PROCESS_START as follows:

$> export COVERAGE_PROCESS_START=".coveragerc"

You must as well include the following lines in the sitecustomize.py of your virtual environment, as follows:

$> echo "import coverage; coverage.process_startup()" > venv/lib/python2.7/site-packages/sitecustomize.py 

Releasing

You can release and deploy automatically by two shell scripts located in etc/, namely release.shand deploy.sh. release.sh tests the application, fetches the version number from arcadia-mock/__init__.py, tags the repository, and finally builds and pushes a new docker image in the fchauvel/arcadia-mock repository. deploy.sh is meant to be run on the remote host. It stops and delete the current container, fetches the latest docker image and restarts a container with it.

After editing the version number as desired, you can release and deploy as follows:

$> source etc/release.sh
$> ssh -i path/to/my/key.pem [email protected] "bash -s" < etc/deploy.sh

arcadia-mock's People

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.