Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

.

  • Loading branch information...
commit 16cfd2e2e06b8de6448885dfde3aa8e7815d70df 1 parent b789ff6
Samuel Chen samuelchen authored
3  src/StorageWorkspace/StorageAPI/src/com/scss/Const.java
@@ -8,7 +8,8 @@
8 8 *
9 9 */
10 10 public final class Const {
11   - public static final String HOST = "s3.amazonaws.com"; // used for testing
  11 + //public static final String HOST = "s3.amazonaws.com"; // used for testing
  12 + public static final String HOST = "s3.itc.cn"; // used for testing
12 13 public static final String XMLNS = "http://doc.s3.amazonaws.com/2006-03-0"; // used for response xml
13 14
14 15 public class REQUEST_METHOD {
12 src/StorageWorkspace/StorageAPI/src/com/scss/Main.java
@@ -3,7 +3,6 @@
3 3 */
4 4 package com.scss;
5 5
6   -import org.restlet.Component;
7 6 import org.restlet.Server;
8 7 import org.restlet.data.Protocol;
9 8
@@ -27,10 +26,13 @@ public static void main(String[] args) throws Exception {
27 26 // component.getDefaultHost().attach("/api", Handler.class);
28 27 // component.start();
29 28
30   - if (args.length > 1 && args[1].equals("serve")) {
31   - CloudServer.shared().start(null, null);
32   - }
33   - else
  29 + if (args.length >= 1) {
  30 + if (args[0].equals("serve"))
  31 + CloudServer.shared().start(null, null);
  32 + else if (Integer.parseInt(args[0]) > 0)
  33 + new Server(Protocol.HTTP, Integer.parseInt(args[0]), Handler.class).start();
  34 + }
  35 + else
34 36 new Server(Protocol.HTTP, 80, Handler.class).start();
35 37 }
36 38
2  src/StorageWorkspace/StorageAPI/src/com/scss/core/APIRequest.java
@@ -66,6 +66,8 @@ public APIRequest(Request request) throws InvaildRequestException {
66 66 this.BucketName = bucket_name.trim();
67 67 this.ObjectKey = path.trim();
68 68
  69 + System.out.printf("BucketName=%s\n ObjectKey=%s\n", this.BucketName, this.ObjectKey);
  70 +
69 71 // get content
70 72 Representation repr = request.getEntity();
71 73 try {
54 src/StorageWorkspace/StorageAPIBotoTest/src/scss/test/object.py
@@ -20,33 +20,33 @@ def tearDown(self):
20 20 pass
21 21
22 22
23   -# def testPostObject(self):
24   -# key = helper.store_data_from_string("boto-test", "obj1", "Test stroe_data_from_string")
25   -# print "store_data_from_string : ", key
26   -# assert(None != key)
27   -#
28   -# def testGetObject(self):
29   -# data = helper.get_data_to_string("boto-test", "obj1")
30   -# print "get_data_to_string : ", data
31   -# assert("Test stroe_data_from_string" == data)
32   -#
33   -# def test_store_data_from_filename(self):
34   -# key = helper.store_data_from_filename("boto-test", "obj2", "Sunset.jpg")
35   -# print "store_data_from_filename : ", key
36   -# assert(None != key)
37   -#
38   -# def test_get_data_to_filename(self):
39   -# import os
40   -# try:
41   -# os.remove("Sunset.Download.jpg");
42   -# except:
43   -# pass
44   -# data = helper.get_data_to_filename("boto-test", "obj2", "Sunset.Download.jpg")
45   -# print "get_data_to_filename : ", data
46   -# assert (os.path.exists("Sunset.Download.jpg"));
47   -# st = os.stat("Sunset.Download.jpg")
48   -# assert(None != st)
49   -# assert(st[6] == 71189)
  23 + def testPostObject(self):
  24 + key = helper.store_data_from_string("boto-test", "obj1", "Test stroe_data_from_string")
  25 + print "store_data_from_string : ", key
  26 + assert(None != key)
  27 +
  28 + def testGetObject(self):
  29 + data = helper.get_data_to_string("boto-test", "obj1")
  30 + print "get_data_to_string : ", data
  31 + assert("Test stroe_data_from_string" == data)
  32 +
  33 + def test_store_data_from_filename(self):
  34 + key = helper.store_data_from_filename("boto-test", "obj2", "Sunset.jpg")
  35 + print "store_data_from_filename : ", key
  36 + assert(None != key)
  37 +
  38 + def test_get_data_to_filename(self):
  39 + import os
  40 + try:
  41 + os.remove("Sunset.Download.jpg");
  42 + except:
  43 + pass
  44 + data = helper.get_data_to_filename("boto-test", "obj2", "Sunset.Download.jpg")
  45 + print "get_data_to_filename : ", data
  46 + assert (os.path.exists("Sunset.Download.jpg"));
  47 + st = os.stat("Sunset.Download.jpg")
  48 + assert(None != st)
  49 + assert(st[6] == 71189)
50 50
51 51 def test_800K_img(self):
52 52 import os

0 comments on commit 16cfd2e

Please sign in to comment.
Something went wrong with that request. Please try again.