Browse files

.

  • Loading branch information...
1 parent b789ff6 commit 16cfd2e2e06b8de6448885dfde3aa8e7815d70df @samuelchen samuelchen committed Feb 29, 2012
View
3 src/StorageWorkspace/StorageAPI/src/com/scss/Const.java
@@ -8,7 +8,8 @@
*
*/
public final class Const {
- public static final String HOST = "s3.amazonaws.com"; // used for testing
+ //public static final String HOST = "s3.amazonaws.com"; // used for testing
+ public static final String HOST = "s3.itc.cn"; // used for testing
public static final String XMLNS = "http://doc.s3.amazonaws.com/2006-03-0"; // used for response xml
public class REQUEST_METHOD {
View
12 src/StorageWorkspace/StorageAPI/src/com/scss/Main.java
@@ -3,7 +3,6 @@
*/
package com.scss;
-import org.restlet.Component;
import org.restlet.Server;
import org.restlet.data.Protocol;
@@ -27,10 +26,13 @@ public static void main(String[] args) throws Exception {
// component.getDefaultHost().attach("/api", Handler.class);
// component.start();
- if (args.length > 1 && args[1].equals("serve")) {
- CloudServer.shared().start(null, null);
- }
- else
+ if (args.length >= 1) {
+ if (args[0].equals("serve"))
+ CloudServer.shared().start(null, null);
+ else if (Integer.parseInt(args[0]) > 0)
+ new Server(Protocol.HTTP, Integer.parseInt(args[0]), Handler.class).start();
+ }
+ else
new Server(Protocol.HTTP, 80, Handler.class).start();
}
View
2 src/StorageWorkspace/StorageAPI/src/com/scss/core/APIRequest.java
@@ -66,6 +66,8 @@ public APIRequest(Request request) throws InvaildRequestException {
this.BucketName = bucket_name.trim();
this.ObjectKey = path.trim();
+ System.out.printf("BucketName=%s\n ObjectKey=%s\n", this.BucketName, this.ObjectKey);
+
// get content
Representation repr = request.getEntity();
try {
View
54 src/StorageWorkspace/StorageAPIBotoTest/src/scss/test/object.py
@@ -20,33 +20,33 @@ def tearDown(self):
pass
-# def testPostObject(self):
-# key = helper.store_data_from_string("boto-test", "obj1", "Test stroe_data_from_string")
-# print "store_data_from_string : ", key
-# assert(None != key)
-#
-# def testGetObject(self):
-# data = helper.get_data_to_string("boto-test", "obj1")
-# print "get_data_to_string : ", data
-# assert("Test stroe_data_from_string" == data)
-#
-# def test_store_data_from_filename(self):
-# key = helper.store_data_from_filename("boto-test", "obj2", "Sunset.jpg")
-# print "store_data_from_filename : ", key
-# assert(None != key)
-#
-# def test_get_data_to_filename(self):
-# import os
-# try:
-# os.remove("Sunset.Download.jpg");
-# except:
-# pass
-# data = helper.get_data_to_filename("boto-test", "obj2", "Sunset.Download.jpg")
-# print "get_data_to_filename : ", data
-# assert (os.path.exists("Sunset.Download.jpg"));
-# st = os.stat("Sunset.Download.jpg")
-# assert(None != st)
-# assert(st[6] == 71189)
+ def testPostObject(self):
+ key = helper.store_data_from_string("boto-test", "obj1", "Test stroe_data_from_string")
+ print "store_data_from_string : ", key
+ assert(None != key)
+
+ def testGetObject(self):
+ data = helper.get_data_to_string("boto-test", "obj1")
+ print "get_data_to_string : ", data
+ assert("Test stroe_data_from_string" == data)
+
+ def test_store_data_from_filename(self):
+ key = helper.store_data_from_filename("boto-test", "obj2", "Sunset.jpg")
+ print "store_data_from_filename : ", key
+ assert(None != key)
+
+ def test_get_data_to_filename(self):
+ import os
+ try:
+ os.remove("Sunset.Download.jpg");
+ except:
+ pass
+ data = helper.get_data_to_filename("boto-test", "obj2", "Sunset.Download.jpg")
+ print "get_data_to_filename : ", data
+ assert (os.path.exists("Sunset.Download.jpg"));
+ st = os.stat("Sunset.Download.jpg")
+ assert(None != st)
+ assert(st[6] == 71189)
def test_800K_img(self):
import os

0 comments on commit 16cfd2e

Please sign in to comment.