[Openstack-operators] *****SPAM***** Re: Swift - usage of JAVA apis bindings from rackspace ??
Marcelo Martins
btorch-os at zeroaccess.org
Sun Apr 10 02:55:42 UTC 2011
Shashidhar,
I'm don't think the java-cloudfiles API currently works with openstack-
swift authentication system. I tried to use the latest version 1.8.1
and also 1.8.0 but was encountering other problems that was
prohibiting me from even reaching my openstack-swift SAIO system.
So I decided to give it a try on an older version I already had
installed (1.5.3 ... I know it's old) ...
Problem #1 : Using SSL with java sucks ..
I didn't feel like troubleshooting java keytool, so I changed my SAIO
setup to no longer use SSL in my proxy-server.
Problem #2: Had to hack two files in order to make authentication work
FILE #1 = src/main/java/com/rackspacecloud/client/cloudfiles/
FilesClient.java
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
377-openstack/src/main/java/com/rackspacecloud/client/cloudfiles/
FilesClient.java
--- rackspace-java-cloudfiles-0ce9377/src/main/java/com/rackspacecloud/
client/cloudfiles/FilesClient.java 2010-02-08 17:46:42.000000000
-0600
+++ rackspace-java-cloudfiles-0ce9377-openstack/src/main/java/com/
rackspacecloud/client/cloudfiles/FilesClient.java 2011-04-09
21:36:32.110095891 -0500
@@ -115,8 +115,10 @@
this.username = username;
this.password = password;
this.account = account;
+
if (account != null && account.length() > 0) {
- this.authenticationURL =
FilesUtil.getProperty("auth_url")+VERSION+"/"+account
+FilesUtil.getProperty("auth_url_post");
+ this.authenticationURL =
FilesUtil.getProperty("auth_url");
+ this.username = account+":"+username;
}
else {
this.authenticationURL =
FilesUtil.getProperty("auth_url");
@@ -192,7 +194,7 @@
{
this.account = account;
if (account != null && account.length() > 0) {
- this.authenticationURL =
FilesUtil.getProperty("auth_url")+VERSION+"/"+account
+FilesUtil.getProperty("auth_url_post");
+ this.authenticationURL =
FilesUtil.getProperty("auth_url");
}
else {
this.authenticationURL =
FilesUtil.getProperty("auth_url");
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FILE #2 = src/main/java/com/rackspacecloud/client/cloudfiles/
FilesResponse.java
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
e9377-openstack/src/main/java/com/rackspacecloud/client/cloudfiles/
FilesResponse.java
--- rackspace-java-cloudfiles-0ce9377/src/main/java/com/rackspacecloud/
client/cloudfiles/FilesResponse.java 2010-02-08 17:46:42.000000000
-0600
+++ rackspace-java-cloudfiles-0ce9377-openstack/src/main/java/com/
rackspacecloud/client/cloudfiles/FilesResponse.java 2011-04-09
20:56:22.826095729 -0500
@@ -51,7 +51,8 @@
if (getStatusCode() == HttpStatus.SC_UNAUTHORIZED )
return false;
- if (getStatusCode() == HttpStatus.SC_NO_CONTENT)
+ /* Marcelo if (getStatusCode() == HttpStatus.SC_NO_CONTENT)
*/
+ if (getStatusCode() == HttpStatus.SC_OK)
return true;
return false;
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Once I was done with modifying the files I compiled it with "ant
compile"
Then I created my "cloudfiles.properties" file
----------------------------------------------------------------------------------------------
version=v1
connection_timeout=5000
# Auth info
auth_url=http://MY_IP_ADDRR:8080/auth/v1.0
auth_token_name=X-Auth-Token
#auth_user_header=X-Auth-User
#auth_pass_header=X-Auth-Key
----------------------------------------------------------------------------------------------
Then I tested the java api using the run_cli.sh
btorch at stone:~/src/rackspace-java-cloudfiles-0ce9377-openstack$ bash
run_cli.sh
Username: marcelo
Password: XXXXXXXXXX
Account (return if using Mosso directly): external
Logged in!
Type 'help' for assistance
external: get
The account has 3 containers
glance
images
test
external: head
Account information:
Number of Containers: 3
Total Account Size: 1938161664
external: head glance
Information for glance
Object Count: 2
Total Size: 1,938,161,664 bytes
....
Then I ran the test unit... I also expected any CDN test units to fail
since openstack-swift does not have CDN:
btorch at stone:~/src/rackspace-java-cloudfiles-0ce9377-openstack$ ant test
Buildfile: build.xml
init:
[echo] -------------------------------------------------
[echo] Building Cloudfiles
[echo] -------------------------------------------------
compile:
[echo] Compiling the source
compile-test:
[echo] Compiling the test source
[javac] Compiling 2 source files to /home/btorch/src/rackspace-
java-cloudfiles-0ce9377-openstack/classes
[copy] Copying 2 files to /home/btorch/src/rackspace-java-
cloudfiles-0ce9377-openstack/classes
[jar] Building jar: /home/btorch/src/rackspace-java-
cloudfiles-0ce9377-openstack/dist/java-cloudfiles-test.jar
test:
[junit] Running
com.rackspacecloud.client.cloudfiles.FilesClientTestCase
[junit] Testsuite:
com.rackspacecloud.client.cloudfiles.FilesClientTestCase
[junit] Tests run: 38, Failures: 8, Errors: 0, Time elapsed:
30.824 sec
[junit] Tests run: 38, Failures: 8, Errors: 0, Time elapsed:
30.824 sec
[junit]
[junit] Testcase:
testConstructor
(com.rackspacecloud.client.cloudfiles.FilesClientTestCase):
FAILED
[junit] expected:<...> but was:<baz:...>
[junit] junit.framework.ComparisonFailure: expected:<...> but
was:<baz:...>
[junit] at
com
.rackspacecloud
.client
.cloudfiles
.FilesClientTestCase.testConstructor(FilesClientTestCase.java:49)
[junit]
[junit]
[junit] Testcase:
testNoArgConstructor
(com.rackspacecloud.client.cloudfiles.FilesClientTestCase): FAILED
[junit] expected:<...> but was:<external:...>
[junit] junit.framework.ComparisonFailure: expected:<...> but
was:<external:...>
[junit] at
com
.rackspacecloud
.client
.cloudfiles
.FilesClientTestCase.testNoArgConstructor(FilesClientTestCase.java:59)
[junit]
[junit]
[junit]
[junit] Testcase:
testCDNContainerList
(com.rackspacecloud.client.cloudfiles.FilesClientTestCase): FAILED
[junit] host parameter is null
[junit] junit.framework.AssertionFailedError: host parameter is
null
[junit] at
com
.rackspacecloud
.client
.cloudfiles
.FilesClientTestCase.testCDNContainerList(FilesClientTestCase.java:1242)
[junit]
[junit]
[junit] Testcase:
testCDNContainerListLimitMarker
(com.rackspacecloud.client.cloudfiles.FilesClientTestCase):
FAILED
[junit] host parameter is null
[junit] junit.framework.AssertionFailedError: host parameter is
null
[junit] at
com
.rackspacecloud
.client
.cloudfiles
.FilesClientTestCase
.testCDNContainerListLimitMarker(FilesClientTestCase.java:1268)
[junit]
[junit]
[junit] Testcase:
testCDNContainerFullListing
(com.rackspacecloud.client.cloudfiles.FilesClientTestCase): FAILED
[junit] host parameter is null
[junit] junit.framework.AssertionFailedError: host parameter is
null
[junit] at
com
.rackspacecloud
.client
.cloudfiles
.FilesClientTestCase
.testCDNContainerFullListing(FilesClientTestCase.java:1293)
[junit]
[junit]
[junit] Testcase:
testCDNContainerFullListingAll
(com.rackspacecloud.client.cloudfiles.FilesClientTestCase): FAILED
[junit] host parameter is null
[junit] junit.framework.AssertionFailedError: host parameter is
null
[junit] at
com
.rackspacecloud
.client
.cloudfiles
.FilesClientTestCase
.testCDNContainerFullListingAll(FilesClientTestCase.java:1307)
[junit]
[junit]
[junit] Testcase:
testCDNApi
(com.rackspacecloud.client.cloudfiles.FilesClientTestCase): FAILED
[junit] host parameter is null
[junit] junit.framework.AssertionFailedError: host parameter is
null
[junit] at
com
.rackspacecloud
.client
.cloudfiles.FilesClientTestCase.testCDNApi(FilesClientTestCase.java:
1366)
[junit]
[junit]
[junit] Testcase:
testURLs
(com.rackspacecloud.client.cloudfiles.FilesClientTestCase): FAILED
[junit] null
[junit] junit.framework.AssertionFailedError
[junit] at
com
.rackspacecloud
.client
.cloudfiles.FilesClientTestCase.testURLs(FilesClientTestCase.java:1526)
[junit]
[junit]
[junit] Test
com.rackspacecloud.client.cloudfiles.FilesClientTestCase FAILED
BUILD SUCCESSFUL
Total time: 34 seconds
-----
btorch at stone:~/src/rackspace-java-cloudfiles-0ce9377-openstack$ ant
test-report
Buildfile: build.xml
init:
[echo] -------------------------------------------------
[echo] Building Cloudfiles
[echo] -------------------------------------------------
compile:
[echo] Compiling the source
[jar] Building jar: /home/btorch/src/rackspace-java-
cloudfiles-0ce9377-openstack/dist/java-cloudfiles.jar
compile-test:
[echo] Compiling the test source
test-report:
[mkdir] Created dir: /home/btorch/src/rackspace-java-
cloudfiles-0ce9377-openstack/testreport
[junit] Test
com.rackspacecloud.client.cloudfiles.FilesClientTestCase FAILED
[junitreport] Processing /home/btorch/src/rackspace-java-
cloudfiles-0ce9377-openstack/testreport/TESTS-TestSuites.xml to /tmp/
null971541946
[junitreport] Loading stylesheet jar:file:/usr/share/ant/lib/ant-
junit.jar!/org/apache/tools/ant/taskdefs/optional/junit/xsl/junit-
frames.xsl
[junitreport] Transform time: 1172ms
[junitreport] Deleting: /tmp/null971541946
BUILD SUCCESSFUL
Total time: 32 seconds
I'm not sure why the newer versions of the java-cloudfiles API were
failing, perhaps I was doing something wrong! I hope this helps a bit
or perhaps sends you to the right track. If I have an update about
java-cloudfiles and openstack-swift compatibility I'll let you know.
-
Marcelo
“Knowledge is the wings on which our aspirations take flight and soar.
When it comes to surfing and life if you know what to do you can do
it. If you desire anything become educated about it and succeed. “
On Apr 6, 2011, at 1:53 AM, shashidhar v wrote:
>
> Hi,
>
> I am trying to build the "rackspace-java-cloudfiles" package (JAVA
> apis) and run the unit tests ... but getting the errors
>
>
>
> [shashi at shashi rackspace-java-cloudfiles-1fb920d]$ cat src/test/
> resources/cloudfiles.properties
>
> # user properties
> username=tester
> password=testing
> account=test
>
> # Auth Info, including two headers that can change for different
> auth services
> #auth_url=http://test1:8080/auth/v1
>
> auth_token_name=X-Auth-Token
> auth_url=http://192.168.62.63:8080/v1/AUTH_74ac0809-6c3f-4a0b-a6c8-6a664477b32a
> auth_user_header=tester
> auth_pass_header=testing
> auth_user_header=X-Storage-User
> auth_pass_header=X-Storage-Pass
>
> # cloudfs properties
> version=v1
> connection_timeout=15000
>
>
>
>
>
>
> [shashi at shashi rackspace-java-cloudfiles-1fb920d]$ ant test
> Buildfile: build.xml
>
> init:
> [echo] -------------------------------------------------
> [echo] Building Cloudfiles
> [echo] -------------------------------------------------
>
> compile:
> [echo] Compiling the source
> [jar] Building jar: /home/shashi/Desktop/rackspace-java-
> cloudfiles-1fb920d/dist/java-cloudfiles.jar
>
> compile-test:
> [echo] Compiling the test source
> [copy] Copying 1 file to /home/shashi/Desktop/rackspace-java-
> cloudfiles-1fb920d/classes
> [jar] Building jar: /home/shashi/Desktop/rackspace-java-
> cloudfiles-1fb920d/dist/java-cloudfiles-test.jar
>
> test:
> [junit] Running
> com.rackspacecloud.client.cloudfiles.FilesClientTestCase
> [junit] Testsuite:
> com.rackspacecloud.client.cloudfiles.FilesClientTestCase
> [junit] Tests run: 44, Failures: 42, Errors: 0, Time elapsed:
> 1.606 sec
> [junit] Tests run: 44, Failures: 42, Errors: 0, Time elapsed:
> 1.606 sec
> [junit]
> [junit] ------------- Standard Error -----------------
> [junit] java.lang.IllegalStateException: Target host must not be
> null, or set in parameters.
> [junit] at
> org
> .apache
> .http
> .impl
> .client
> .DefaultRequestDirector.determineRoute(DefaultRequestDirector.java:
> 651)
> [junit] at
> org
> .apache
> .http
> .impl
> .client.DefaultRequestDirector.execute(DefaultRequestDirector.java:
> 353)
> [junit] at
> org
> .apache
> .http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:
> 641)
> [junit] at
> org
> .apache
> .http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:
> 576)
> [junit] at
> org
> .apache
> .http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:
> 554)
> [junit] at
> com
> .rackspacecloud.client.cloudfiles.FilesClient.login(FilesClient.java:
> 278)
> [junit] at
> com
> .rackspacecloud
> .client
> .cloudfiles
> .FilesClientTestCase.testUnicodeContainer(FilesClientTestCase.java:
> 1401)
> [junit] at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> [junit] at
> sun
> .reflect
> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> [junit] at
> sun
> .reflect
> .DelegatingMethodAccessorImpl
> .invoke(DelegatingMethodAccessorImpl.java:25)
> [junit] at java.lang.reflect.Method.invoke(Method.java:597)
> [junit] at junit.framework.TestCase.runTest(TestCase.java:164)
> [junit] at junit.framework.TestCase.runBare(TestCase.java:130)
> [junit] at junit.framework.TestResult
> $1.protect(TestResult.java:106)
> [junit] at
> junit.framework.TestResult.runProtected(TestResult.java:124)
> [junit] at junit.framework.TestResult.run(TestResult.java:109)
> [junit] at junit.framework.TestCase.run(TestCase.java:120)
> [junit] at junit.framework.TestSuite.runTest(TestSuite.java:
> 230)
> [junit] at junit.framework.TestSuite.run(TestSuite.java:225)
> [junit] at
> org
> .apache
> .tools
> .ant
> .taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:421)
> [junit] at
> org
> .apache
> .tools
> .ant.taskdefs.optional.junit.JUnitTask.executeInVM(JUnitTask.java:
> 1245)
> [junit] at
> org
> .apache
> .tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:
> 814)
> [junit] at
> org
> .apache
> .tools
> .ant.taskdefs.optional.junit.JUnitTask.executeOrQueue(JUnitTask.java:
> 1657)
> [junit] at
> org
> .apache
> .tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:
> 765)
> [junit] at
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
> [junit] at
> sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
> [junit] at
> sun
> .reflect
> .DelegatingMethodAccessorImpl
> .invoke(DelegatingMethodAccessorImpl.java:25)
> [junit] at java.lang.reflect.Method.invoke(Method.java:597)
> [junit] at
> org
> .apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:
> 105)
> [junit] at org.apache.tools.ant.Task.perform(Task.java:348)
> [junit] at org.apache.tools.ant.Target.execute(Target.java:
> 357)
> [junit] at
> org.apache.tools.ant.Target.performTasks(Target.java:385)
> [junit] at
> org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
> [junit] at
> org.apache.tools.ant.Project.executeTarget(Project.java:1298)
> [junit] at
> org
> .apache
> .tools
> .ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
> [junit] at
> org.apache.tools.ant.Project.executeTargets(Project.java:1181)
> [junit] at org.apache.tools.ant.Main.runBuild(Main.java:698)
> [junit] at org.apache.tools.ant.Main.startAnt(Main.java:199)
> [junit] at
> org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
> [junit] at
> org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
> [junit] java.lang.IllegalStateException: Target host must not be
> null, or set in parameters.
> [junit] at
> org
> .apache
> .http
> .impl
> .client
> .DefaultRequestDirector.determineRoute(DefaultRequestDirector.java:
> 651)
> [junit] at
> org
> .apache
> .http
> .impl
> .client.DefaultRequestDirector.execute(DefaultRequestDirector.java:
> 353)
> [junit] at
> org
> .apache
> .http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:
> 641)
> [junit] at
> org
> .apache
> .http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:
> 576)
> [junit] at
> org
> .apache
> .http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:
> 554)
> [junit] at
> com
> .rackspacecloud.client.cloudfiles.FilesClient.login(FilesClient.java:
> 278)
> [junit] at
> com
> .rackspacecloud
> .client
> .cloudfiles.FilesClientTestCase.testUnicode(FilesClientTestCase.java:
> 1432)
> [junit] at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> [junit] at
> sun
> .reflect
> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> [junit] at
> sun
> .reflect
> .DelegatingMethodAccessorImpl
> .invoke(DelegatingMethodAccessorImpl.java:25)
> [junit] at java.lang.reflect.Method.invoke(Method.java:597)
> [junit] at junit.framework.TestCase.runTest(TestCase.java:164)
> [junit] at junit.framework.TestCase.runBare(TestCase.java:130)
> [junit] at junit.framework.TestResult
> $1.protect(TestResult.java:106)
> [junit] at
> junit.framework.TestResult.runProtected(TestResult.java:124)
> [junit] at junit.framework.TestResult.run(TestResult.java:109)
> [junit] at junit.framework.TestCase.run(TestCase.java:120)
> [junit] at junit.framework.TestSuite.runTest(TestSuite.java:
> 230)
> [junit] at junit.framework.TestSuite.run(TestSuite.java:225)
> [junit] at
> org
> .apache
> .tools
> .ant
> .taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:421)
> [junit] at
> org
> .apache
> .tools
> .ant.taskdefs.optional.junit.JUnitTask.executeInVM(JUnitTask.java:
> 1245)
> [junit] at
> org
> .apache
> .tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:
> 814)
> [junit] at
> org
> .apache
> .tools
> .ant.taskdefs.optional.junit.JUnitTask.executeOrQueue(JUnitTask.java:
> 1657)
> [junit] at
> org
> .apache
> .tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:
> 765)
> [junit] at
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
> [junit] at
> sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
> [junit] at
> sun
> .reflect
> .DelegatingMethodAccessorImpl
> .invoke(DelegatingMethodAccessorImpl.java:25)
> [junit] at java.lang.reflect.Method.invoke(Method.java:597)
> [junit] at
> org
> .apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:
> 105)
> [junit] at org.apache.tools.ant.Task.perform(Task.java:348)
> [junit] at org.apache.tools.ant.Target.execute(Target.java:
> 357)
> [junit] at
> org.apache.tools.ant.Target.performTasks(Target.java:385)
> [junit] at
> org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
> [junit] at
> org.apache.tools.ant.Project.executeTarget(Project.java:1298)
> [junit] at
> org
> .apache
> .tools
> .ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
> [junit] at
> org.apache.tools.ant.Project.executeTargets(Project.java:1181)
> [junit] at org.apache.tools.ant.Main.runBuild(Main.java:698)
> [junit] at org.apache.tools.ant.Main.startAnt(Main.java:199)
> [junit] at
> org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
> [junit] at
> org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
> [junit] ------------- ---------------- ---------------
> [junit] Testcase:
> testLogin
> (com.rackspacecloud.client.cloudfiles.FilesClientTestCase):
> FAILED
> [junit] null
> [junit] junit.framework.AssertionFailedError
> [junit] at
> com
> .rackspacecloud
> .client
> .cloudfiles.FilesClientTestCase.testLogin(FilesClientTestCase.java:68)
> [junit]
> [junit]
> [junit] Testcase:
> testAccountInfo
> (com.rackspacecloud.client.cloudfiles.FilesClientTestCase):
> FAILED
> [junit] null
> [junit] junit.framework.AssertionFailedError
> [junit] at
> com
> .rackspacecloud
> .client
> .cloudfiles
> .FilesClientTestCase.testAccountInfo(FilesClientTestCase.java:92)
> [junit]
> [junit]
> [junit] Testcase:
> testMultipleFilesNotThere
> (com.rackspacecloud.client.cloudfiles.FilesClientTestCase):
> FAILED
> [junit] null
>
> ===============
> =======
> =====
>
>
> [junit]
> [junit] Testcase:
> testFilesObjectPath
> (com.rackspacecloud.client.cloudfiles.FilesClientTestCase): FAILED
> [junit] null
> [junit] junit.framework.AssertionFailedError
> [junit] at
> com
> .rackspacecloud
> .client
> .cloudfiles
> .FilesClientTestCase.testFilesObjectPath(FilesClientTestCase.java:
> 1783)
> [junit]
> [junit]
> [junit] Testcase:
> testURLs
> (com.rackspacecloud.client.cloudfiles.FilesClientTestCase):
> FAILED
> [junit] null
> [junit] junit.framework.AssertionFailedError
> [junit] at
> com
> .rackspacecloud
> .client
> .cloudfiles.FilesClientTestCase.testURLs(FilesClientTestCase.java:
> 1826)
> [junit]
> [junit]
> [junit] Test
> com.rackspacecloud.client.cloudfiles.FilesClientTestCase FAILED
>
> BUILD SUCCESSFUL
> Total time: 5 seconds
> [shashi at shashi rackspace-java-cloudfiles-1fb920d]$
>
>
> I was not clear about the properties to be set for running the "unit
> tests" of rackspace cloud files - java apis package , kindly help me
> for usage of java apis w.r.t swift
>
>
> Thanks & Regards,
> shashi
> _______________________________________________
> Openstack-operators mailing list
> Openstack-operators at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-
> operators
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-operators/attachments/20110410/d483a734/attachment-0001.html>
More information about the Openstack-operators
mailing list