Permalink
Browse files

Reviewing Reform

  • Loading branch information...
1 parent 8aa018e commit 8a882889f9fa01e5ffe4e9ea0c25267a73ba4a61 Msekni Bilel committed Nov 20, 2012
Showing with 56 additions and 1,016 deletions.
  1. +0 −1 .gitignore
  2. +1 −1 HTTP_HowTo.rst
  3. +25 −0 README.rst
  4. +13 −11 pyocni/TDD/Tests/queryInterface_Tests.py
  5. +7 −19 pyocni/TDD/fake_Data/categories.py
  6. +1 −0 pyocni/TDD/fake_Data/initialize_fakeDB.py
  7. +0 −20 pyocni/TDD/request_examples/delete_actions.json
  8. +0 −31 pyocni/TDD/request_examples/delete_categories.json
  9. +0 −16 pyocni/TDD/request_examples/delete_kinds.json
  10. +0 −15 pyocni/TDD/request_examples/delete_mixins.json
  11. +0 −39 pyocni/TDD/request_examples/filter_categories.json
  12. +0 −36 pyocni/TDD/request_examples/full_update_link.json
  13. +0 −47 pyocni/TDD/request_examples/full_update_resource.json
  14. +0 −25 pyocni/TDD/request_examples/get_actions.json
  15. +0 −16 pyocni/TDD/request_examples/get_kinds.json
  16. +0 −13 pyocni/TDD/request_examples/get_mixins.json
  17. +0 −25 pyocni/TDD/request_examples/get_res_link_b_path.json
  18. +0 −16 pyocni/TDD/request_examples/partial_update_link.json
  19. +0 −33 pyocni/TDD/request_examples/partial_update_resource.json
  20. +0 −39 pyocni/TDD/request_examples/post_actions.json
  21. +0 −97 pyocni/TDD/request_examples/post_categories.json
  22. +0 −35 pyocni/TDD/request_examples/post_custom_link.json
  23. +0 −46 pyocni/TDD/request_examples/post_custom_resource.json
  24. +0 −49 pyocni/TDD/request_examples/post_kinds.json
  25. +0 −35 pyocni/TDD/request_examples/post_links.json
  26. +0 −28 pyocni/TDD/request_examples/post_mixins.json
  27. +0 −80 pyocni/TDD/request_examples/post_resources.json
  28. +0 −41 pyocni/TDD/request_examples/put_actions.json
  29. +0 −103 pyocni/TDD/request_examples/put_categories.json
  30. +0 −44 pyocni/TDD/request_examples/put_kinds.json
  31. +0 −28 pyocni/TDD/request_examples/put_mixins.json
  32. +0 −23 pyocni/TDD/request_examples/put_providers.json
  33. +4 −0 pyocni/adapters/cnv_toJSON.py
  34. +2 −0 pyocni/adapters/httpRequest_Formater.py
  35. +0 −3 pyocni/dispachers/queryDispatcher.py
  36. +1 −1 pyocni/junglers/managers/kindManager.py
  37. +1 −0 pyocni/occi_server.conf
  38. +1 −0 pyocni/pyocni_tools/config.py
View
@@ -41,7 +41,6 @@ Thumbs.db
build/
dist/
pyocni.egg-info/
-pyocni/TDD
# Testing file
#########################
View
@@ -102,7 +102,7 @@ It's up to the user to define what format he wants in the request Content-Type h
N/A
-4.Full Update of a category (Kind or Mixin or Action)::
+4.Update of a category (Kind or Mixin or Action)::
curl -X PUT -d@put_category -H 'content-type: text/plain' -H 'accept: text/plain' -v http://localhost:8090/-/
View
@@ -239,6 +239,13 @@ PyOCNI offers two OCCI rendering formats : **HTTP and JSON**. The following comm
N/A
+6.Update a kind provider::
+
+ curl -X PUT -d@update_provider.json -H 'content-type: application/occi+json' -H 'accept: application/occi+json' -v http://localhost:8090/-/
+
+* Response::
+
+ N/A
4.2. Path management
----------------------
@@ -617,6 +624,24 @@ Some of pyocni's needs might be:
]
}
+* update_provider.json::
+
+ {
+ "providers": [
+ {
+ "Provider": {
+ "local": [
+ "dummy"
+ ],
+ "remote": [
+ "Bilel"
+ ]
+ },
+ "OCCI_ID": "http://schemas.ogf.org/occi/infrastructure#compute"
+ }
+ ]
+ }
+
* get_resources.json::
{
@@ -49,11 +49,12 @@ def setUp(self):
self.p = Process(target=start_server)
self.p.start()
time.sleep(0.5)
- init_fakeDB()
+ #init_fakeDB()
time.sleep(0.5)
def tearDown(self):
- config.purge_PyOCNI_db()
+
+ #config.purge_PyOCNI_db()
self.p.terminate()
def test_get_categories(self):
@@ -64,9 +65,9 @@ def test_get_categories(self):
storage = StringIO.StringIO()
c = pycurl.Curl()
c.setopt(c.URL, 'http://127.0.0.1:8090/-/')
- c.setopt(c.HTTPHEADER, ['Accept:text/plain'])
+ c.setopt(c.HTTPHEADER, ['Accept:application/occi+json','content-type:application/occi+json'])
c.setopt(c.VERBOSE, True)
- #c.setopt(c.POSTFIELDS,f_entities.action_occci_id)
+ c.setopt(c.POSTFIELDS,f_categories.kind)
c.setopt(c.CUSTOMREQUEST, 'GET')
c.setopt(c.WRITEFUNCTION, storage.write)
c.perform()
@@ -86,7 +87,7 @@ def setUp(self):
self.p = Process(target=start_server)
self.p.start()
time.sleep(0.5)
- #init_fakeDB()
+ init_fakeDB()
time.sleep(0.5)
def tearDown(self):
@@ -103,8 +104,8 @@ def test_delete_categories(self):
c.setopt(c.CUSTOMREQUEST, 'DELETE')
c.setopt(c.URL, 'http://127.0.0.1:8090/-/')
- c.setopt(c.HTTPHEADER, ['Accept: application/occi+json', 'Content-Type: text/plain'])
- c.setopt(c.POSTFIELDS, f_categories.action_occci_id)
+ c.setopt(c.HTTPHEADER, ['Accept: application/occi+json', 'Content-Type: application/occi+json'])
+ c.setopt(c.POSTFIELDS, f_categories.kind)
c.setopt(c.VERBOSE, True)
c.setopt(c.WRITEFUNCTION, storage.write)
@@ -129,6 +130,7 @@ def setUp(self):
time.sleep(0.5)
def tearDown(self):
+
self.p.terminate()
#config.purge_PyOCNI_db()
@@ -141,9 +143,9 @@ def test_register_categories(self):
storage = StringIO.StringIO()
c.setopt(c.URL, 'http://127.0.0.1:8090/-/')
- c.setopt(c.HTTPHEADER, ['Content-Type: text/plain', 'Accept: application/occi+json'])
+ c.setopt(c.HTTPHEADER, ['Content-Type: application/occi+json', 'Accept: application/occi+json'])
- c.setopt(c.POSTFIELDS, f_categories.kind_http)
+ c.setopt(c.POSTFIELDS, f_categories.kind)
c.setopt(c.CUSTOMREQUEST, 'POST')
c.setopt(c.WRITEFUNCTION, storage.write)
@@ -181,7 +183,7 @@ def test_update_categories(self):
c.setopt(c.URL, 'http://127.0.0.1:8090/-/')
c.setopt(c.HTTPHEADER, ['Content-Type: application/occi+json', 'Accept: application/occi+json'])
c.setopt(c.CUSTOMREQUEST, 'PUT')
- c.setopt(c.POSTFIELDS, f_categories.action)
+ c.setopt(c.POSTFIELDS, f_categories.put_provider)
c.setopt(c.WRITEFUNCTION, storage.write)
c.perform()
content = storage.getvalue()
@@ -203,4 +205,4 @@ def test_update_categories(self):
#Run tests
- runner.run(put_suite)
+ runner.run(delete_suite)
@@ -107,7 +107,7 @@
"title": "Start Compute instance now",
"attributes": {
"method": {
- "mutable": true,
+ "mutable": false,
"required": false,
"type": "string",
"pattern": "graceful|acpion|poweron",
@@ -140,16 +140,6 @@
}
"""
-provider_up = """
-{
- "Providers": {
- "remote": [],
- "local": [
- "dummy"
- ]
- }
-}"""
-
action_plus_attributes =\
"""
{
@@ -192,8 +182,8 @@
#=======================================================================================================================
kind_occci_id = """Category: compute;
- scheme="http://schemas.ogf.org/occi/infrastructure#";
- class=kind;
+scheme="http://schemas.ogf.org/occi/infrastructure#";
+class=kind;
"""
#=======================================================================================================================
@@ -203,9 +193,7 @@
"""
#=======================================================================================================================
-action_occci_id = """Category: start;
- scheme="http://schemas.ogf.org/occi/infrastructure/compute/action#";
- class=action;
+action_occci_id = """Category: start;scheme="http://schemas.ogf.org/occi/infrastructure/compute/action#"; class=action;
"""
#=======================================================================================================================
@@ -214,16 +202,16 @@
"class=\"mixin\";"\
"title=\"Storage Resource\";"\
"location=\"/my_stuff/\";"\
- "attributes=\"occi.storage.size{required} occi.storage.state{immutable}\";"\
+ "attributes=\"occi.storage.size{required},occi.storage.state{immutable}\";"\
\
#=======================================================================================================================
-kind_http = "Category: compute;"\
+kind_http = "Category: compute5;"\
"scheme=\"http://schemas.ogf.org/occi/infrastructure#\";"\
"class=\"kind\";"\
"title=\"Compute Resource type\";"\
"rel=\"http://schemas.ogf.org/occi/core#resource\";"\
- "attributes=\"occi.compute.cores occi.compute.state{immutable}\";"\
+ "attributes=\"occi.compute.cores, occi.compute.state{immutable}\";"\
"actions=\"http://schemas.ogf.org/occi/infrastructure/compute/action#stop\";"\
"location=\"http://example.com/compute/\""
#=======================================================================================================================
@@ -34,6 +34,7 @@ def init_fakeDB():
add_fake_action()
add_fake_kind()
add_fake_mixin()
+ add_fake_resource()
def add_fake_kind():
@@ -1,20 +0,0 @@
-/*
-
- =1= Delete of multiple actions at the same time is possible
- =2= Term and scheme are the only required object members to delete an action
- =3= Delete actions is not safe, do it at your own risk
-
- */
-
-{
- "actions":[
- {
- "term":"stop",
- "scheme":"http://schemas.ogf.org/occi/infrastructure/compute/action#"
- },
- {
- "term":"start",
- "scheme":"http://schemas.ogf.org/occi/infrastructure/compute/action#"
- }
- ]
-}
@@ -1,31 +0,0 @@
-/*
-
- =1= Delete of multiple kinds,mixins and actions can be done at the same time
- =2= Object members term and scheme MUST exist in each description
-
- */
-
-{
- "kinds":[
- {
- "term":"compute",
- "scheme":"http://schemas.ogf.org/occi/infrastructure#"
- }
- ],
- "mixins":[
- {
- "term":"medium",
- "scheme":"http://example.com/template/resource#"
- }
- ],
- "actions":[
- {
- "term":"stop",
- "scheme":"http://schemas.ogf.org/occi/infrastructure/compute/action#"
- },
- {
- "term":"start",
- "scheme":"http://schemas.ogf.org/occi/infrastructure/compute/action#"
- }
- ]
-}
@@ -1,16 +0,0 @@
-/*
-
- =1= Delete of multiple kinds at the same time is possible
- =2= Term and scheme are the only required object members to delete a kind
- =3= A kind can be deleted only if there are no resources of it
-
- */
-
-{
- "kinds":[
- {
- "term":"compute",
- "scheme":"http://schemas.ogf.org/occi/infrastructure#"
- }
- ]
-}
@@ -1,15 +0,0 @@
-/*
-
- =1= Delete of multiple mixins at the same time is possible
- =2= term and scheme are the only required object members to delete a mixin
-
- */
-
-{
- "mixins":[
- {
- "term":"medium",
- "scheme":"http://example.com/template/resource#"
- }
- ]
-}
@@ -1,39 +0,0 @@
-/*
-
- =1= Filtering multiple kinds,mixins and actions can be done all at the same time
- =2= Filtering categories can be done through the object members specified in the JSON rendering draft
-
- */
-
-{
- "kinds":[
- {
- "actions":[
- "http://schemas.ogf.org/occi/infrastructure/compute/action#start",
- "http://schemas.ogf.org/occi/infrastructure/compute/action#stop"
- ]
- }
- ],
- "mixins":[
- {
- "location":"/template/resource/medium/"
- }
- ],
- "actions":[
- {
- "attributes":{
- "method":{
- "mutable":true,
- "required":false,
- "type":"string",
- "pattern":"graceful|acpioff|poweroff",
- "default":"poweroff"
- }
- }
- },
- {
- "term":"start",
- "scheme":"http://schemas.ogf.org/occi/infrastructure/compute/action#"
- }
- ]
-}
@@ -1,36 +0,0 @@
-/*
-
- =1= Only one link can be updated at a same time
- =2= Full description MUST be provided
- =3= Link description MUST follow the OCCI JSON rendering draft link description specifications
- =4= kind and id are forbidden to change
-
- */
-
-{
- "links":[
- {
- "kind":"http://schemas.ogf.org/occi/infrastructure#networkinterface",
- "mixins":[
- "http://example.com/template/resource#medium"
- ],
- "attributes":{
- "occi":{
- "infrastructure":{
- "networkinterface":{
- "interface":"eth0",
- "mac":"00:80:41:ae:fd:7e",
- "address":"192.168.0.100",
- "gateway":"192.168.0.1",
- "allocation":"dynamic"
- }
- }
- }
- },
- "id":"22fe83ae-a20f-54fc-b436-cec85c94c5e8",
- "title":"Mynetworkinterface",
- "target":"http://127.0.0.1:8090/compute/996ad860-2a9a-504f-8861-aeafd0b2ae30",
- "source":"http://127.0.0.1:8090/compute/996ad860-2a9a-504f-8861-aeafd0b2ae29"
- }
- ]
-}
Oops, something went wrong.

0 comments on commit 8a88288

Please sign in to comment.