Skip to content

jprovaznik/tim

 
 

Repository files navigation

<img src=“https://secure.travis-ci.org/aeolus-incubator/tim.png” alt=“Build Status” />

Tests are run from the project root directory. But are run in the context of the dummy app located under test/dummy. In order to run the tests you must first setup dummy app database.

rake db:setup; rake -f test/dummy/Rakefile test:prepare

Once you have done this cd to the project root and run the following:

rake spec

This will allow you to runn the commands below to test out the engine in isolation (if mounted in another application, the main difference will just be where the engine gets mounted, so adjust your url accordingly).

cd test/dummy; rails s

Request

curl -X POST --header "Accept: application/xml" --header "Content-Type: application/xml" --data "
<template>
   <name>mock</name>
   <os>
     <name>RHEL-6</name>
     <version>1</version>
     <arch>x86_64</arch>
     <install type=\"iso\">
       <iso>http://mockhost/RHELMock1-x86_64-DVD.iso</iso>
     </install>
     <rootpw>password</rootpw>
  </os>
  <description>Mock Template</description>
</template>
" http://localhost:3000/tim/templates

Response

Code: 201

Body:

<template href='http://localhost:3000/tim/templates/34' id='34'>
  <name>mock</name><os>
      <name>RHEL-6</name>
      <version>1</version>
      <arch>x86_64</arch>
      <install type="iso">
        <iso>http://mockhost/RHELMock1-x86_64-DVD.iso</iso>
      </install>
      <rootpw>password</rootpw>
    </os><description>Mock Template</description>
  <base_images>
  </base_images>
  <custom_content>custom</custom_content>
</template>

Request

curl --header "Accept:application/xml" http://localhost:3000/tim/templates/34

Response

Code: 200

Body:

<template href='http://localhost:3000/tim/templates/34' id='34'>
  <name>mock</name><os>
      <name>RHEL-6</name>
      <version>1</version>
      <arch>x86_64</arch>
      <install type="iso">
        <iso>http://mockhost/RHELMock1-x86_64-DVD.iso</iso>
      </install>
      <rootpw>password</rootpw>
    </os><description>Mock Template</description>
  <base_images>
  </base_images>
  <custom_content>custom</custom_content>
</template>

Request

curl --header "Accept:application/xml" http://localhost:3000/tim/templates

Response

Code: 200

Body:

<templates>
  <template href='http://localhost:3000/tim/templates/33' id='33'></template>
  <template href='http://localhost:3000/tim/templates/35' id='35'></template>
  <template href='http://localhost:3000/tim/templates/36' id='36'></template>
</templates>

Request

curl -X DELETE --header "Accept: application/xml" http://localhost:3000/tim/templates/34

Response

Code: 204

Body:

Request

curl -X POST --header "Accept: application/xml" --header "Content-Type: application/xml" --data "
<base_image>
  <name>MyFirstBaseImage</name>
  <description>This is my very first base image</description>
  <template>
    <name>mock</name>
    <os>
      <name>RHEL-6</name>
      <version>1</version>
      <arch>x86_64</arch>
      <install type=\"iso\">
        <iso>http://mockhost/RHELMock1-x86_64-DVD.iso</iso>
      </install>
      <rootpw>password</rootpw>
    </os>
    <description>Mock Template</description>
  </template>
</base_image>
" http://localhost:3000/tim/base_images

Response

Code: 201

Body:

<base_image href='http://localhost:3000/tim/base_images/15' id='15'>
  <name>MyFirstBaseImage</name>
  <description>This is my very first base image</description>
  <template href='http://localhost:3000/tim/templates/36' id='36'></template>
  <image_versions>
  </image_versions>
</base_image>

Request

curl -X POST --header "Accept: application/xml" --header "Content-Type: application/xml" --data "
<base_image>
  <name>MyFirstBaseImage</name>
  <description>ThisIsABaseImage</description>
  <template>
    <name>mock</name>
    <os>
      <name>RHEL-6</name>
      <version>1</version>
      <arch>x86_64</arch>
      <install type=\"iso\">
        <iso>http://mockhost/RHELMock1-x86_64-DVD.iso</iso>
      </install>
      <rootpw>password</rootpw>
    </os>
    <description>Mock Template</description>
  </template>
  <image_versions type='array'>
   <image_version>
      <target_images type='array'>
        <target_image>
          <target>MockSphere</target>
        </target_image>
      </target_images>
    </image_version>
  </image_versions>
</base_image>
" http://localhost:3000/tim/base_images

Response

Code: 201

Body:

<base_image href='http://localhost:3000/tim/base_images/16' id='16'>
  <name>MyFirstBaseImage</name>
  <description>ThisIsABaseImage</description>
  <template href='http://localhost:3000/tim/templates/37' id='37'></template>
  <image_versions>
    <image_version href='http://localhost:3000/tim/image_versions/12' id='12'></image_version>
  </image_versions>
</base_image>

Request

curl --header "Accept: application/xml" http://localhost:3000/tim/base_images/1

Response

Code: 200

Body:

<base_image href='http://localhost:3000/tim/base_images/1' id='1'>
  <name>MyFirstBaseImage</name>
  <description>This is my very first base image</description>
  <image_versions>
    <image_version href='http://localhost:3000/tim/image_versions/1' id='1'></image_version>
  </image_versions>
</base_image>

Request

curl --header "Accept: application/xml" http://localhost:3000/tim/base_images

Response

Code: 200

Body:

<base_images>
  <base_image href='http://localhost:3000/tim/base_images/1' id='1'></base_image>
  <base_image href='http://localhost:3000/tim/base_images/2' id='2'></base_image>
  <base_image href='http://localhost:3000/tim/base_images/3' id='3'></base_image>
</base_images>

Request

curl -X DELETE --header "Accept: application/xml" http://localhost:3000/tim/base_images/1

Response

Code: 204

Body:

Request

curl -X POST --header "Accept: application/xml" --header \
"Content-Type: application/xml" http://localhost:3000/tim/image_versions --data \
"<image_version>
  <base_image id='3'></base_image>
</image_version>"

Response

Code: 201

Body:

<image_version href='http://localhost:3000/tim/image_versions/5' id='5'>
  <base_image href='http://localhost:3000/tim/base_images/1' id='1'></base_image>
  <target_images>
  </target_images>
</image_version>

Request

curl --header "Accept: application/xml" http://localhost:3000/tim/image_versions/1

Response

Code: 200

Body:

<image_version href='http://localhost:3000/tim/image_versions/1' id='1'>
  <base_image href='http://localhost:3000/tim/base_images/1' id='1'></base_image>
  <target_images>
  </target_images>
</image_version>

Request

curl --header "Accept: application/xml" http://localhost:3000/tim/image_versions

Response

Code: 200

Body:

<image_versions>
  <image_version href='http://localhost:3000/tim/image_versions/1' id='1'></image_version>
  <image_version href='http://localhost:3000/tim/image_versions/2' id='2'></image_version>
  <image_version href='http://localhost:3000/tim/image_versions/3' id='3'></image_version>
</image_versions>

Request

curl -X DELETE--header "Accept: application/xml" http://localhost:3000/tim/image_versions/1

Response

Code: 204

Body:

Request

curl -X PUT --header "Accept: application/xml" --header \
"Content-Type: application/xml" http://localhost:3000/tim/image_versions/1 --data \
"<image_version>
  <base_image id='2'></base_image>
</image_version>"

Response

Code: 200

body:

<image_version href='http://localhost:3000/tim/image_versions/1' id='1'>
  <base_image href='http://localhost:3000/tim/base_images/2' id='2'></base_image>
  <target_images>
  </target_images>
</image_version>

Request

curl -X POST --header "Accept: application/xml" --header \
"Content-Type: application/xml" http://localhost:3000/tim/target_images --data \
"<target_image>
  <image_version id='2' />
</target_image>"

Response

Code: 201

Body:

<target_image href=‘localhost:3000/tim/target_images/1’ id=‘1’>

<target>EC2</target>
<status>BUILDING</status>
<status_detail></status_detail>
<progress>0</progress>
<image_version href='http://localhost:3000/tim/image_versions/2' id='2'></image_version>
<provider_images></provider_images>

</target_image>

Request

curl --header "Accept: application/xml" http://localhost:3000/tim/target_images/1

Response

Code: 200

Body:

<target_image href='http://localhost:3000/tim/target_images/1' id='1'>
  <target>EC2</target>
  <status>COMPLETE</status>
  <status_detail></status_detail>
  <progress>100</progress>
  <image_version href='http://localhost:3000/tim/image_versions/2' id='2'></image_version>
  <provider_images></provider_images>
</target_image>

Request

curl --header "Accept: application/xml" http://localhost:3000/tim/target_images

Response

Code: 200

Body:

<target_images>
  <target_image href='http://localhost:3000/tim/target_images/1' id='1'></target_image>
  <target_image href='http://localhost:3000/tim/target_images/2' id='2'></target_image>
  <target_image href='http://localhost:3000/tim/target_images/3' id='3'></target_image>
</target_images>

Request

curl -X DELETE --header "Accept: application/xml" http://localhost:3000/tim/target_images/1

Response

Code: 204

Body:

Request

curl -X PUT --header "Accept: application/xml" --header \
"Content-Type: application/xml" http://localhost:3000/tim/target_images/2 --data \
"<target_image>
  <image_version id='3'></image_version>
</target_image>"

Response

Code: 204

Request

curl -X POST --header "Accept: application/xml" --header \
"Content-Type: application/xml" http://localhost:3000/tim/provider_images --data \
"<provider_image>
  <target_image id='1' />
</provider_image>"

Response

Code: 201

Body:

<provider_image href='http://localhost:3000/tim/provider_images/85' id='85'>
  <provider>Amazon EC2</provider>
  <external_image_id>ami-123456</external_image_id>
  <snapshot>false</snapshot>
  <status>NEW</status>
  <status_detail></status_detail>
  <progress>0</progress>
  <target_image href='http://localhost:3000/tim/target_images/1' id='1'></target_image>
</provider_image>

Request

curl --header "Accept: application/xml" http://localhost:3000/tim/provider_images/1

Response

Code: 200

Body:

<provider_image href='http://localhost:3000/tim/provider_images/85' id='85'>
  <provider>Amazon EC2</provider>
  <external_image_id>ami-123456</external_image_id>
  <snapshot>false</snapshot>
  <status>NEW</status>
  <status_detail></status_detail>
  <progress>0</progress>
  <target_image href='http://localhost:3000/tim/target_images/1' id='1'></target_image>
</provider_image>

Request

curl --header "Accept: application/xml" http://localhost:3000/tim/provider_images

Response

Code: 200

Body:

<provider_images>
  <provider_image href='http://localhost:3000/tim/provider_images/1' id='1'></provider_image>
  <provider_image href='http://localhost:3000/tim/provider_images/2' id='2'></provider_image>
  <provider_image href='http://localhost:3000/tim/provider_images/3' id='3'></provider_image>
</provider_image>

Request

curl -X DELETE --header "Accept: application/xml" http://localhost:3000/tim/provider_images/1

Response

Code: 204

Body:

Request

curl -X PUT --header "Accept: application/xml" --header \
"Content-Type: application/xml" http://localhost:3000/tim/provider_images/2 --data \
"<provider_image>
  <target_image id='3'></target_image>
</provider_image>"

Response

Code: 204

Body:

<provider_image href='http://localhost:3000/tim/provider_images/84' id='84'>
  <provider></provider>
  <external_image_id></external_image_id>
  <snapshot></snapshot>
  <status></status>
  <status_detail></status_detail>
  <progress></progress>
  <target_image href='http://localhost:3000/tim/target_images/3' id='3'></target_image>
</provider_image>

Image Management Engine is released under the MIT license.

About

Web application for managing virtual images to be deployed in the cloud

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Ruby 98.7%
  • JavaScript 1.3%