Merge lp:~karni/ubuntu-sso-java-library/v2-initial-import into lp:~ubuntuone-client-engineering/ubuntu-sso-java-library/v2

Proposed by Michał Karnicki
Status: Merged
Approved by: Michał Karnicki
Approved revision: 4
Merged at revision: 4
Proposed branch: lp:~karni/ubuntu-sso-java-library/v2-initial-import
Merge into: lp:~ubuntuone-client-engineering/ubuntu-sso-java-library/v2
Diff against target: 563 lines (+502/-0)
8 files modified
.bzrignore (+16/-0)
.classpath.template (+25/-0)
.project.template (+17/-0)
README.md (+63/-0)
ant.properties (+49/-0)
build.xml (+307/-0)
src/main/java/com/ubuntu/one/api/accounts/U1Accounts.java (+4/-0)
src/test/java/com/ubuntu/one/api/accounts/U1AccountsTest.java (+21/-0)
To merge this branch: bzr merge lp:~karni/ubuntu-sso-java-library/v2-initial-import
Reviewer Review Type Date Requested Status
Mike McCracken (community) Approve
Review via email: mp+140481@code.launchpad.net

Commit message

Initial import.

Description of the change

Initial import of new, robust code base setup. Ant build tool; dir-structure Maven ready.

How to test:
$ bzr branch lp:~karni/ubuntu-sso-java-library/v2-initial-import foo
$ cd foo
$ ant setup jar

To post a comment you must log in.
Revision history for this message
Mike McCracken (mikemc) wrote :

A couple minor things:

The .project.template has the name as 'ubuntuone-sso' - should it be 'ubuntu-sso' like the LP project name?

README: same question about naming, should it be "ubuntu sso"?

README: line 81 of the diff typo: "Single Sing On"

build.xml: same project name question in a couple of places.
The package ID (is that the right name for it in java?) ends up being com.ubuntu.one.api.sso -- should that be com.ubuntu.sso.api or something?

In the python packages, the SSO stuff is a packaged named "ubuntu_sso" and the U1 specific stuff is named "ubuntuone.*" -- does a similar naming split make sense here?

review: Needs Information
2. By Michał Karnicki

Unzip jmock in ./lib/test.

3. By Michał Karnicki

Review fixes. Updated naming convention.

4. By Michał Karnicki

Fixed package names.

Revision history for this message
Mike McCracken (mikemc) wrote :

Looks good, builds & tests fine for me on mac os 10.7

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file '.bzrignore'
2--- .bzrignore 1970-01-01 00:00:00 +0000
3+++ .bzrignore 2012-12-18 21:35:23 +0000
4@@ -0,0 +1,16 @@
5+bin
6+target
7+.project
8+.classpath
9+lib
10+lib/signpost-commonshttp4-*.jar
11+lib/signpost-core-*.jar
12+lib/commons-codec-*.jar
13+lib/commons-logging-*.jar
14+lib/httpcore-*.jar
15+lib/httpclient-*.jar
16+lib/jackson-mini-*.jar
17+lib/lombok.jar
18+lib/test/junit-*.jar
19+lib/test/jmock-*.jar
20+lib/test/hamcrest-all-*.jar
21
22=== added file '.classpath.template'
23--- .classpath.template 1970-01-01 00:00:00 +0000
24+++ .classpath.template 2012-12-18 21:35:23 +0000
25@@ -0,0 +1,25 @@
26+<?xml version="1.0" encoding="UTF-8"?>
27+<classpath>
28+ <classpathentry kind="src" path="src/main/java" />
29+ <classpathentry kind="src" path="src/test/java" />
30+ <classpathentry kind="lib" path="lib/signpost-commonshttp4-1.2.1.1.jar" />
31+ <classpathentry kind="lib" path="lib/signpost-core-1.2.1.1.jar" />
32+ <classpathentry kind="lib" path="lib/commons-codec-1.4.jar" />
33+ <classpathentry kind="lib" path="lib/commons-logging-1.1.1.jar" />
34+ <classpathentry kind="lib" path="lib/httpclient-4.1.3.jar" />
35+ <classpathentry kind="lib" path="lib/httpcore-4.1.3.jar" />
36+ <classpathentry kind="lib" path="lib/jackson-mini-1.9.5.jar" />
37+
38+ <classpathentry kind="lib" path="lib/lombok.jar" />
39+
40+ <!-- Test -->
41+ <classpathentry kind="lib" path="lib/test/junit-4.10.jar" />
42+ <classpathentry kind="lib" path="lib/test/jmock-2.5.1.jar" />
43+ <classpathentry kind="lib" path="lib/test/hamcrest-all-1.2.jar" />
44+
45+<!--
46+ <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4" />
47+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6" />
48+-->
49+ <classpathentry kind="output" path="bin" />
50+</classpath>
51
52=== added file '.project.template'
53--- .project.template 1970-01-01 00:00:00 +0000
54+++ .project.template 2012-12-18 21:35:23 +0000
55@@ -0,0 +1,17 @@
56+<?xml version="1.0" encoding="UTF-8"?>
57+<projectDescription>
58+ <name>ubuntuone-accounts</name>
59+ <comment></comment>
60+ <projects>
61+ </projects>
62+ <buildSpec>
63+ <buildCommand>
64+ <name>org.eclipse.jdt.core.javabuilder</name>
65+ <arguments>
66+ </arguments>
67+ </buildCommand>
68+ </buildSpec>
69+ <natures>
70+ <nature>org.eclipse.jdt.core.javanature</nature>
71+ </natures>
72+</projectDescription>
73
74=== added file 'README.md'
75--- README.md 1970-01-01 00:00:00 +0000
76+++ README.md 2012-12-18 21:35:23 +0000
77@@ -0,0 +1,63 @@
78+# What is this?
79+
80+Ubuntu One Accounts Java library, formerly known as
81+Ubuntu Single Sign On Java library, talks to
82+Ubuntu One authentications and accounts REST APIs.
83+It allows you to:
84+ * register and authenticate users
85+ * retrieve account details
86+ * list and manage connected devices
87+
88+# tl;dr
89+
90+Build with:
91+
92+ $ ant setup jar
93+
94+Find the jar under ./target/dist directory.
95+
96+# How do I build it?
97+
98+You can download a jar file directly from the project page
99+on [Launchpad](https://launchpad.net/ubuntu-sso-java-library)
100+or, if you prefer, you can build it from source.
101+
102+To download dependencies, run:
103+
104+ $ ant setup
105+
106+To build a jar file, run:
107+
108+ $ ant jar
109+
110+You will find the jar file in the ./target/dist directory.
111+
112+# How do I hack it?
113+
114+If you use Eclipse, first run:
115+
116+ $ ant setup eclipse
117+
118+Which will download the dependencies and create fresh copies of
119+.project and .classpath files for you.
120+
121+# How do I use it?
122+
123+Grab lp:~karni/ubuntu-sso-java-library/sso-cli-example
124+from [Launchpad](https://code.launchpad.net/ubuntu-sso-java-library)
125+and have a look at the source code. This example shows how to
126+sign up and sign in using the library.
127+
128+Grab lp:~karni/ubuntuone-files-java-library/cli-ubuntuone
129+from [Launchpad](https://code.launchpad.net/ubuntuone-files-java-library).
130+This example involves sign in only.
131+
132+# Feedback
133+
134+If you have comments or ideas for improvements, do not hesitate
135+to contact Ubuntu One team on irc.freenode.net at #ubuntuone channel.
136+(Feel free to ping me directly, I am *karni* on Freenode).
137+
138+# Misc
139+
140+Project uses ant build tool, but has maven-ready directory structure.
141
142=== added file 'ant.properties'
143--- ant.properties 1970-01-01 00:00:00 +0000
144+++ ant.properties 2012-12-18 21:35:23 +0000
145@@ -0,0 +1,49 @@
146+java.encoding=UTF-8
147+
148+lib.signpost.ver=1.2.1.1
149+url.oasp=http://oauth-signpost.googlecode.com/files
150+
151+lib.signpost-core.jar=signpost-core-${lib.signpost.ver}.jar
152+lib.signpost-core.url=${url.oasp}/${lib.signpost-core.jar}
153+
154+lib.signpost-commonshttp4.jar=signpost-commonshttp4-${lib.signpost.ver}.jar
155+lib.signpost-commonshttp4.url=${url.oasp}/${lib.signpost-commonshttp4.jar}
156+
157+url.ibiblio=http://mirrors.ibiblio.org/pub/mirrors/maven2
158+
159+lib.commons-codec.ver=1.4
160+lib.commons-codec.jar=commons-codec-${lib.commons-codec.ver}.jar
161+lib.commons-codec.url=${url.ibiblio}/commons-codec/commons-codec/${lib.commons-codec.ver}/${lib.commons-codec.jar}
162+
163+lib.commons-logging.ver=1.1.1
164+lib.commons-logging.jar=commons-logging-${lib.commons-logging.ver}.jar
165+lib.commons-logging.url=${url.ibiblio}/commons-logging/commons-logging/${lib.commons-logging.ver}/${lib.commons-logging.jar}
166+
167+lib.httpcore.ver=4.1.3
168+lib.httpcore.jar=httpcore-${lib.httpcore.ver}.jar
169+lib.httpcore.url=${url.ibiblio}/org/apache/httpcomponents/httpcore/${lib.httpcore.ver}/${lib.httpcore.jar}
170+
171+lib.httpclient.ver=4.1.3
172+lib.httpclient.jar=httpclient-${lib.httpclient.ver}.jar
173+lib.httpclient.url=${url.ibiblio}/org/apache/httpcomponents/httpclient/${lib.httpclient.ver}/${lib.httpclient.jar}
174+
175+lib.jackson-mini.ver=1.9.5
176+lib.jackson-mini.jar=jackson-mini-${lib.jackson-mini.ver}.jar
177+lib.jackson-mini.url=http://jackson.codehaus.org/${lib.jackson-mini.ver}/${lib.jackson-mini.jar}
178+
179+lib.lombok.jar=lombok.jar
180+lib.lombok.url=http://projectlombok.googlecode.com/files/lombok.jar
181+
182+lib.junit.ver=4.10
183+lib.junit.jar=junit-${lib.junit.ver}.jar
184+lib.junit.url=${url.ibiblio}/junit/junit/${lib.junit.ver}/${lib.junit.jar}
185+
186+lib.jmock.ver=2.5.1
187+lib.jmock.zip=jmock-${lib.jmock.ver}-jars.zip
188+lib.jmock.jar=jmock-${lib.jmock.ver}.jar
189+lib.jmock.url=http://cloud.github.com/downloads/jmock-developers/jmock-library/${lib.jmock.zip}
190+
191+lib.hamcrest-all.ver=1.2
192+lib.hamcrest-all.jar=hamcrest-all-${lib.hamcrest-all.ver}.jar
193+lib.hamcrest-all.url=http://hamcrest.googlecode.com/files/${lib.hamcrest-all.jar}
194+
195
196=== added file 'build.xml'
197--- build.xml 1970-01-01 00:00:00 +0000
198+++ build.xml 2012-12-18 21:35:23 +0000
199@@ -0,0 +1,307 @@
200+<?xml version="1.0"?>
201+<project name="ubuntuone-accounts" default="jar" basedir=".">
202+
203+ <description>
204+ *** Ubuntu One Accounts ***
205+
206+ Ubuntu One Accounts Java library
207+ http://launchpad.net/ubuntu-sso-java-library
208+
209+ API documentation:
210+ http://one.ubuntu.com/developer
211+ -> Account Admin APIs
212+
213+ Contact:
214+ IRC: #ubuntuone @ irc.freenode.net
215+
216+ For instructions on building, see README.md
217+ </description>
218+
219+ <property environment="env" />
220+
221+ <property file="build.properties" />
222+ <property file="ant.properties" />
223+
224+ <property name="project.groupId" value="com.ubuntu.one.api.accounts" />
225+ <property name="project.artifactId" value="ubuntuone-accounts" />
226+
227+ <exec
228+ executable="bash"
229+ outputproperty="project.version"
230+ failonerror="true">
231+
232+ <arg value="-c" />
233+ <arg value="bzr tags|head -n1|cut -d' ' -f1" />
234+ </exec>
235+ <exec
236+ executable="bzr"
237+ outputproperty="project.revision"
238+ failonerror="true">
239+
240+ <arg value="revno" />
241+ </exec>
242+
243+ <property name="target" value="${basedir}/target" />
244+ <property name="src.home" value="${basedir}/src/main/java" />
245+ <property name="resource.home" value="${basedir}/src/main/resources" />
246+ <property name="build.home" value="${target}/jar" />
247+ <property name="dist.dir" value="${target}/dist" />
248+ <property name="generated.home" value="${basedir}/src/main/generated" />
249+
250+ <!-- Test -->
251+ <property name="test.dir" value="${target}/test" />
252+ <property name="test.dir.src" value="${basedir}/src/test/java" />
253+ <property name="test.dir.data" value="src/main/test/resources" />
254+ <property name="test.dir.classes" value="${test.dir}/classes" />
255+ <property name="test.dir.reports" value="${test.dir}/reports" />
256+
257+ <property name="lib" value="${basedir}/lib" />
258+ <property name="lib.test" value="${basedir}/lib/test" />
259+
260+ <patternset id="support.jars.patternset">
261+ <include name="*.jar" />
262+ </patternset>
263+
264+ <patternset id="test.jars.patternset">
265+ <include name="*.jar" />
266+ </patternset>
267+
268+ <path id="compile.classpath">
269+ <fileset
270+ id="compile.jars"
271+ dir="${lib}">
272+
273+ <patternset refid="support.jars.patternset" />
274+ </fileset>
275+ </path>
276+
277+ <path id="test.compile.classpath">
278+ <path refid="compile.classpath" />
279+ <fileset dir="${basedir}/lib/test">
280+ <patternset refid="test.jars.patternset" />
281+ </fileset>
282+ </path>
283+
284+ <path id="test.classpath">
285+ <path refid="test.compile.classpath" />
286+ <path>
287+ <fileset dir="lib/test">
288+ <patternset refid="test.jars.patternset" />
289+ </fileset>
290+ </path>
291+ <pathelement location="${test.dir.classes}" />
292+ </path>
293+
294+ <target
295+ name="version"
296+ description="Prints project version and bzr revision">
297+
298+ <echo message="Version: ${project.version}" />
299+ <echo message="Revision: ${project.revision}" />
300+ </target>
301+
302+ <target
303+ name="all"
304+ depends="clean,test"
305+ description="Clean build and dist directories, then compile" />
306+
307+ <target
308+ name="clean"
309+ description="Delete old build and dist directories">
310+
311+ <delete dir="${target}" />
312+ <delete dir="${generated.home}" />
313+ <mkdir dir="${generated.home}" />
314+ </target>
315+
316+ <target
317+ name="clean-lib"
318+ description="Delete downloaded jar files">
319+
320+ <delete dir="${lib}" />
321+ </target>
322+
323+ <target
324+ name="clean-all"
325+ depends="clean,clean-lib"
326+ description="Delete jars and build directories" />
327+
328+ <target
329+ name="compile"
330+ depends="prepare"
331+ description="Compile Java sources">
332+
333+ <javac
334+ destdir="${build.home}"
335+ debug="${compile.debug}"
336+ debuglevel="lines,vars,source"
337+ deprecation="${compile.deprecation}"
338+ optimize="${compile.optimize}"
339+ includeantruntime="false">
340+
341+ <classpath refid="compile.classpath" />
342+ <src path="${src.home}" />
343+ <src path="${generated.home}" />
344+ </javac>
345+ </target>
346+
347+ <target
348+ name="jar"
349+ depends="compile,test"
350+ description="Create binary distribution">
351+
352+ <!-- Copy resources -->
353+ <copy todir="${build.home}">
354+ <fileset
355+ dir="${resource.home}"
356+ excludes="**/*.java" />
357+ </copy>
358+ <delete dir="${dist.dir}" />
359+ <mkdir dir="${dist.dir}" />
360+ <jar
361+ jarfile="${dist.dir}/${project.artifactId}-${project.version}.jar"
362+ basedir="${build.home}" />
363+ </target>
364+
365+ <target
366+ name="test.init"
367+ unless="skipTests">
368+
369+ <mkdir dir="${test.dir.classes}" />
370+ <delete dir="${test.dir.reports}" />
371+ <mkdir dir="${test.dir.reports}" />
372+ </target>
373+
374+ <target
375+ name="test-compile"
376+ depends="compile, test.init"
377+ unless="skipTests">
378+
379+ <javac
380+ srcdir="${test.dir.src}"
381+ destdir="${test.dir.classes}"
382+ debug="${compile.debug}"
383+ debuglevel="lines,vars,source"
384+ deprecation="${compile.deprecation}"
385+ includeantruntime="true">
386+
387+ <classpath refid="test.compile.classpath" />
388+ </javac>
389+ </target>
390+
391+ <target
392+ name="test"
393+ depends="test-compile"
394+ description="Test application"
395+ unless="skipTests">
396+
397+ <junit
398+ printsummary="yes"
399+ haltonfailure="no">
400+
401+ <classpath refid="test.classpath" />
402+ <formatter type="plain" />
403+ <batchtest
404+ fork="yes"
405+ todir="${test.dir.reports}">
406+ <fileset dir="${test.dir.classes}">
407+ <include name="**/*.class" />
408+ </fileset>
409+ </batchtest>
410+ </junit>
411+ </target>
412+
413+ <target
414+ name="javadoc"
415+ depends="compile"
416+ description="Create Javadoc API documentation">
417+
418+ <mkdir dir="docs/api" />
419+ <javadoc
420+ sourcepath="${src.home}"
421+ destdir="docs/api"
422+ packagenames="*">
423+
424+ <classpath refid="compile.classpath" />
425+ </javadoc>
426+ </target>
427+
428+ <target name="prepare">
429+ <mkdir dir="${build.home}" />
430+ <mkdir dir="${generated.home}" />
431+ </target>
432+
433+ <target name="get-jars">
434+
435+ <mkdir dir="${lib}" />
436+ <mkdir dir="${lib.test}" />
437+
438+ <!-- Dependencies -->
439+
440+ <get src="${lib.signpost-core.url}" dest="${lib}"
441+ verbose="on" usetimestamp="true" maxtime="60" />
442+
443+ <get src="${lib.signpost-commonshttp4.url}" dest="${lib}"
444+ verbose="on" usetimestamp="true" maxtime="60" />
445+
446+ <get src="${lib.commons-codec.url}" dest="${lib}"
447+ verbose="on" usetimestamp="true" maxtime="60" />
448+
449+ <get src="${lib.commons-logging.url}" dest="${lib}"
450+ verbose="on" usetimestamp="true" maxtime="60" />
451+
452+ <get src="${lib.httpcore.url}" dest="${lib}"
453+ verbose="on" usetimestamp="true" maxtime="60" />
454+
455+ <get src="${lib.httpclient.url}" dest="${lib}"
456+ verbose="on" usetimestamp="true" maxtime="60" />
457+
458+ <get src="${lib.jackson-mini.url}" dest="${lib}"
459+ verbose="on" usetimestamp="true" maxtime="60" />
460+
461+ <!-- Compile only -->
462+
463+ <get src="${lib.lombok.url}" dest="${lib}"
464+ verbose="on" usetimestamp="true" maxtime="60" />
465+
466+ <!-- Test -->
467+
468+ <get src="${lib.junit.url}" dest="${lib.test}"
469+ verbose="on" usetimestamp="true" maxtime="60" />
470+
471+ <get src="${lib.jmock.url}" dest="${lib.test}"
472+ verbose="on" usetimestamp="true" maxtime="60" />
473+ <unzip src="${lib.test}/${lib.jmock.zip}" dest="${lib.test}">
474+ <patternset>
475+ <include name="**/${lib.jmock.jar}" />
476+ <!--<include name="**/${lib.jmock-junit4.jar}" />-->
477+ </patternset>
478+ <mapper type="flatten" />
479+ </unzip>
480+ <delete file="${lib.test}/${lib.jmock.zip}" quiet="true" />
481+
482+ <get src="${lib.hamcrest-all.url}" dest="${lib.test}"
483+ verbose="on" usetimestamp="true" maxtime="60" />
484+ </target>
485+
486+ <target
487+ name="setup"
488+ depends="get-jars"
489+ description="Download project depenencies.">
490+
491+ <echo message="Downloaded all project dependencies." />
492+ </target>
493+
494+ <target
495+ name="eclipse"
496+ description="Create fresh .project and .classpath">
497+
498+ <copy
499+ file=".project.template"
500+ tofile=".project" />
501+ <copy
502+ file=".classpath.template"
503+ tofile=".classpath" />
504+ </target>
505+</project>
506+
507
508=== added directory 'src'
509=== added directory 'src/main'
510=== added directory 'src/main/config'
511=== added directory 'src/main/filters'
512=== added directory 'src/main/generated'
513=== added directory 'src/main/java'
514=== added directory 'src/main/java/com'
515=== added directory 'src/main/java/com/ubuntu'
516=== added directory 'src/main/java/com/ubuntu/one'
517=== added directory 'src/main/java/com/ubuntu/one/api'
518=== added directory 'src/main/java/com/ubuntu/one/api/accounts'
519=== added file 'src/main/java/com/ubuntu/one/api/accounts/U1Accounts.java'
520--- src/main/java/com/ubuntu/one/api/accounts/U1Accounts.java 1970-01-01 00:00:00 +0000
521+++ src/main/java/com/ubuntu/one/api/accounts/U1Accounts.java 2012-12-18 21:35:23 +0000
522@@ -0,0 +1,4 @@
523+package com.ubuntu.one.api.accounts;
524+
525+public class U1Accounts {
526+}
527
528=== added directory 'src/main/resources'
529=== added directory 'src/test'
530=== added directory 'src/test/filters'
531=== added directory 'src/test/java'
532=== added directory 'src/test/java/com'
533=== added directory 'src/test/java/com/ubuntu'
534=== added directory 'src/test/java/com/ubuntu/one'
535=== added directory 'src/test/java/com/ubuntu/one/api'
536=== added directory 'src/test/java/com/ubuntu/one/api/accounts'
537=== added file 'src/test/java/com/ubuntu/one/api/accounts/U1AccountsTest.java'
538--- src/test/java/com/ubuntu/one/api/accounts/U1AccountsTest.java 1970-01-01 00:00:00 +0000
539+++ src/test/java/com/ubuntu/one/api/accounts/U1AccountsTest.java 2012-12-18 21:35:23 +0000
540@@ -0,0 +1,21 @@
541+package com.ubuntu.one.api.accounts;
542+
543+import org.junit.After;
544+import org.junit.Assert;
545+import org.junit.Before;
546+import org.junit.Test;
547+
548+public class U1AccountsTest {
549+ @Before
550+ public void doBefore() {
551+ }
552+
553+ @After
554+ public void doAfter() {
555+ }
556+
557+ @Test
558+ public void aTest() {
559+ Assert.assertTrue(true);
560+ }
561+}
562
563=== added directory 'src/test/resources'

Subscribers

People subscribed via source and target branches

to all changes: