提交 d8fab22a 编写于 作者: J Jake Wharton

Mavenize.

上级 b0241b3d
lib
out
build
.classpath
.project
.settings
eclipsebin
bin
gen
target
pom.xml.*
release.properties
.idea
*.iml
obj
.DS_Store
workspace.xml
dictionaries/
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AntConfiguration">
<defaultAnt bundledAnt="true" />
<buildFile url="file://$PROJECT_DIR$/build.xml">
<additionalClassPath />
<antReference projectDefault="true" />
<customJdkName value="" />
<maximumHeapSize value="128" />
<maximumStackSize value="2" />
<properties />
</buildFile>
</component>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectCodeStyleSettingsManager">
<option name="PER_PROJECT_SETTINGS">
<value>
<XML>
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
</XML>
</value>
</option>
</component>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<option name="DEFAULT_COMPILER" value="Javac" />
<resourceExtensions>
<entry name=".+\.(properties|xml|html|dtd|tld)" />
<entry name=".+\.(gif|png|jpeg|jpg)" />
</resourceExtensions>
<wildcardResourcePatterns>
<entry name="?*.properties" />
<entry name="?*.xml" />
<entry name="?*.gif" />
<entry name="?*.png" />
<entry name="?*.jpeg" />
<entry name="?*.jpg" />
<entry name="?*.html" />
<entry name="?*.dtd" />
<entry name="?*.tld" />
<entry name="?*.ftl" />
</wildcardResourcePatterns>
<annotationProcessing enabled="false" useClasspath="true" />
</component>
</project>
<component name="CopyrightManager">
<settings default="">
<module2copyright />
</settings>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
</project>
<component name="InspectionProjectProfileManager">
<profile version="1.0" is_locked="false">
<option name="myName" value="Project Default" />
<option name="myLocal" value="false" />
<inspection_tool class="JavaDoc" enabled="false" level="WARNING" enabled_by_default="false">
<option name="TOP_LEVEL_CLASS_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="" />
</value>
</option>
<option name="INNER_CLASS_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="" />
</value>
</option>
<option name="METHOD_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
</value>
</option>
<option name="FIELD_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="" />
</value>
</option>
<option name="IGNORE_DEPRECATED" value="false" />
<option name="IGNORE_JAVADOC_PERIOD" value="true" />
<option name="IGNORE_DUPLICATED_THROWS" value="false" />
<option name="IGNORE_POINT_TO_ITSELF" value="false" />
<option name="myAdditionalJavadocTags" value="" />
</inspection_tool>
</profile>
</component>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<settings>
<option name="PROJECT_PROFILE" value="Project Default" />
<option name="USE_PROJECT_PROFILE" value="true" />
<version value="1.0" />
</settings>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="JARs">
<CLASSES>
<root url="file://$PROJECT_DIR$/lib" />
<root url="jar://$PROJECT_DIR$/build/retrofit-gson-2.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/lib/junit-4.8.1-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/android-test-2.2.1-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/build/retrofit-gson-2.1-sources.jar!/" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib" recursive="false" />
</library>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<entry_points version="2.0" />
<list size="1">
<item index="0" class="java.lang.String" itemvalue="com.google.inject.Inject" />
</list>
</component>
<component name="JavadocGenerationManager">
<option name="OUTPUT_DIRECTORY" />
<option name="OPTION_SCOPE" value="protected" />
<option name="OPTION_HIERARCHY" value="true" />
<option name="OPTION_NAVIGATOR" value="true" />
<option name="OPTION_INDEX" value="true" />
<option name="OPTION_SEPARATE_INDEX" value="true" />
<option name="OPTION_DOCUMENT_TAG_USE" value="false" />
<option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false" />
<option name="OPTION_DOCUMENT_TAG_VERSION" value="false" />
<option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true" />
<option name="OPTION_DEPRECATED_LIST" value="true" />
<option name="OTHER_OPTIONS" value="" />
<option name="HEAP_SIZE" />
<option name="LOCALE" />
<option name="OPEN_IN_BROWSER" value="true" />
</component>
<component name="ProjectResources">
<default-html-doctype>http://www.w3.org/1999/xhtml</default-html-doctype>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="1.6" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
<component name="SvnBranchConfigurationManager">
<option name="mySupportsUserInfoFilter" value="true" />
</component>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/modules/android/android.iml" filepath="$PROJECT_DIR$/modules/android/android.iml" />
<module fileurl="file://$PROJECT_DIR$/modules/core/core.iml" filepath="$PROJECT_DIR$/modules/core/core.iml" />
<module fileurl="file://$PROJECT_DIR$/modules/http/http.iml" filepath="$PROJECT_DIR$/modules/http/http.iml" />
<module fileurl="file://$PROJECT_DIR$/modules/io/io.iml" filepath="$PROJECT_DIR$/modules/io/io.iml" />
<module fileurl="file://$PROJECT_DIR$/modules/android/test_app/test_app.iml" filepath="$PROJECT_DIR$/modules/android/test_app/test_app.iml" />
</modules>
</component>
</project>
<component name="DependencyValidationManager">
<state>
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
</state>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
# Retrofit
Retrofit
========
Reusable Java and Android code from Square, Inc.
Reusable Java and Android code from Square, Inc.
Modules:
+ IO: Utility classes for doing low-level java I/O.
+ Http: Abstracts away the messy logic of making network calls (depends on IO).
+ Core: Some interfaces and utilities used by the other retrofit modules.
+ Android: Contains two Android-specific utility classes: ShakeDetector (for detecting device
shakes) and QueueFile (for storing a queue on the android file-system).
* IO - Utility classes for doing low-level java I/O.
* HTTP - Abstracts away the messy logic of making network calls (depends on IO).
* Core - Some interfaces and utilities used by the other retrofit modules.
* Android - Contains two Android-specific utility classes: `ShakeDetector` (for detecting device
shakes) and `QueueFile` (for storing a queue on the android file-system).
Note that IntelliJ will complain about compilation errors until you run `ant` (to download all the
dependencies). This command also generates the .jar files that you'll want to include in your
application.
Http Usage
----------
## Http Usage
Create an interface for your API. You can create as many of these interfaces as you like. For
each interface you create, calling `RestAdapter.service(MyInterface.class)` will create an
instance of that API handler, which you can then store and use throughout your application. An
Create an interface for your API. You can create as many of these interfaces as you like. For
each interface you create, calling `RestAdapter.service(MyInterface.class)` will create an
instance of that API handler, which you can then store and use throughout your application. An
example interface:
public interface DummyService {
// Produces a url like "foo/bar?id=idValue".
@GET("foo/bar")
@GET("foo/bar")
void normalGet(@Named("id") String id, Callback<SimpleResponse> callback);
// Produces a url like "foo/idValue/bar?category=categoryValue".
......@@ -32,22 +30,38 @@ example interface:
void getWithPathParam(@Named("id") String id, @Named("category") String category, Callback<SimpleResponse> callback);
// Produces a url like "foo/bar/idValue" and body like "id=idValue&body=bodyValue".
@POST("foo/bar/{id}")
@POST("foo/bar/{id}")
void normalPost(@Named("id") String id, @Named("body") String body, Callback<SimpleResponse> callback);
// Produces a url like "foo/bar/idValue" and body generated by MyJsonObj.
@POST("foo/bar/{id}")
@POST("foo/bar/{id}")
void singleEntityPost(@SingleEntity MyJsonObj card, @Named("id") String id, Callback<SimpleResponse> callback);
}
Note that each method _must_ have a Callback object at the end of the parameter list. This is how
your application will handle the results of your network calls: errors and successful responses are
both handled by the Callback interface.
Note that each method _must_ have a `Callback` object at the end of the parameter list. This is how
your application will handle the results of your network calls: errors and successful responses are
both handled by the `Callback` interface.
If you want to use the `@SingleEntity` method of specifying request body (see `singleEntityPost` above),
your `MyJsonObject` will need to implement `TypedBytes`. For convenience, you can extend
`GsonRequestEntity` if you're just trying to send a JSON string in the request body.
Also worth noting: for POST/PUT requests using default form encoding for the request entity (see
normalPost), any path parameters are also included in the request body. This is different from the
behavior of GET/DELETE, where path parameters are excluded from the query string.
Compilation
-----------
Retrofit is built using Maven and there is a very minimal amount of setup required for compilation.
Two environment variables are required which point to your Android SDK and native Android SDK. A common
place to put these is in a `.bash_profile` file in your home directory.
If you want to use the @SingleEntity method of specifying request body (see singleEntityPost above),
your MyJsonObject will need to implement TypedBytes. For convenience, you can extend
\GsonRequestEntity if you're just trying to send a JSON string in the request body.
export ANDROID_HOME=~/dev/android-sdk
export ANDROID_NDK_HOME=~/dev/android-ndk
Also worth noting: for POST/PUT requests using default form encoding for the request entity (see
normalPost), any path parameters are also included in the request body. This is different from the
behavior of GET/DELETE, where path parameters are excluded from the query string.
\ No newline at end of file
With these two environment variables loaded you can compile the modules and sample application by running
`mvn clean verify`. Each module's built artifact will be in its respective `target/` folder.
......@@ -2,7 +2,7 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := retrofit
LOCAL_MODULE := retrofit-android-native
LOCAL_SRC_FILES := retrofit.c
include $(BUILD_SHARED_LIBRARY)
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.squareup</groupId>
<artifactId>retrofit</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<groupId>com.squareup</groupId>
<artifactId>retrofit-android-native</artifactId>
<packaging>so</packaging>
<name>Retrofit Android (Native)</name>
<build>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.squareup</groupId>
<artifactId>retrofit</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<groupId>com.squareup</groupId>
<artifactId>retrofit-android</artifactId>
<packaging>jar</packaging>
<name>Retrofit Android</name>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
......@@ -478,7 +478,7 @@ public class QueueFile {
/**
* Removes the eldest element.
*
* @throw NoSuchElementException if the queue is empty
* @throws NoSuchElementException if the queue is empty
*/
public synchronized void remove() throws IOException {
if (isEmpty()) throw new NoSuchElementException();
......
// Copyright 2010 Square, Inc.
package retrofit.android;
import junit.framework.TestCase;
import java.util.List;
/** @author Eric Burke (eric@squareup.com) */
public class ShakeDetectorTest extends TestCase {
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
/**
* @author Eric Burke (eric@squareup.com)
*/
public class ShakeDetectorTest {
public void testInitialShaking() {
ShakeDetector.SampleQueue q = new ShakeDetector.SampleQueue();
assertFalse("shaking", q.isShaking());
}
/** Tests LG Ally sample rate. */
/**
* Tests LG Ally sample rate.
*/
public void testShakingSampleCount3() {
ShakeDetector.SampleQueue q = new ShakeDetector.SampleQueue();
......
// Copyright 2010 Square, Inc.
package retrofit.io;
import org.junit.After;
import org.junit.Before;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.RandomAccessFile;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.logging.Logger;
import junit.framework.ComparisonFailure;
import junit.framework.TestCase;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
/**
* Tests for QueueFile.
......@@ -19,7 +22,7 @@ import junit.framework.TestCase;
* @author Bob Lee (bob@squareup.com)
*/
@SuppressWarnings({"ResultOfMethodCallIgnored"})
public class QueueFileTest extends TestCase {
public class QueueFileTest {
private static final Logger logger =
Logger.getLogger(QueueFileTest.class.getName());
......@@ -41,12 +44,12 @@ public class QueueFileTest extends TestCase {
private File file;
@Override protected void setUp() throws Exception {
@Before protected void setUp() throws Exception {
file = File.createTempFile("test.queue", null);
file.delete();
}
@Override protected void tearDown() throws Exception {
@After protected void tearDown() throws Exception {
file.delete();
}
......@@ -283,14 +286,6 @@ public class QueueFileTest extends TestCase {
assertEquals(2, iteration[0]);
}
/** Compares two byte[]s for equality. */
private static void assertEquals(byte[] expected, byte[] actual) {
if (!Arrays.equals(expected, actual)) {
throw new ComparisonFailure(null, Arrays.toString(expected),
Arrays.toString(actual));
}
}
/**
* Exercise a bug where wrapped elements were getting corrupted when the
* QueueFile was forced to expand in size and a portion of the final Element
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2010 Square, Inc. -->
<!--
- Ant macro definitions.
-->
<project name="Macros" basedir="." default="help">
<target name="help">
<echo>Import this build file into the main build.xml.</echo>
</target>
<!--
- Compiles a module.
-->
<macrodef name="compile.module">
<attribute name="module"
description="The directory name under 'modules'."/>
<element name="compile.main.classpath" optional="true"/>
<element name="compile.tests.classpath" optional="true"/>
<sequential>
<mkdir dir="${build.dir}/@{module}/main"/>
<!-- Compile src/* and place classes in build/[module]/main. -->
<javac srcdir="modules/@{module}/src"
destdir="${build.dir}/@{module}/main"
fork="true"
debug="true"
includeantruntime="false">
<classpath>
<fileset dir="${lib.dir}" includes="*.jar"/>
<compile.main.classpath/>
</classpath>
</javac>
<!-- Compile src-tests/* and place classes in build/[module]/tests. -->
<mkdir dir="${build.dir}/@{module}/tests"/>
<javac srcdir="modules/@{module}/src-tests"
destdir="${build.dir}/@{module}/tests"
fork="true"
debug="true"
includeantruntime="false">
<classpath>
<fileset dir="${lib.dir}" includes="*.jar"/>
<pathelement location="${build.dir}/@{module}/main"/>
<compile.tests.classpath/>
</classpath>
</javac>
</sequential>
</macrodef>
<!--
- Builds a module's JAR file.
-->
<macrodef name="jar.module">
<attribute name="module"
description="The directory name under 'modules'."/>
<element name="compile.main.classpath" optional="true"/>
<element name="compile.tests.classpath" optional="true"/>
<sequential>
<!-- Create the JAR files. -->
<jar jarfile="${build.dir}/retrofit-@{module}-${retrofit.revision}.jar">
<manifest>
<attribute name="Build-Time" value="${build.time}"/>
<attribute name="Copyright"
value="${build.year}, Square, Inc."/>
<attribute name="Commit-Hash" value="${commit.hash}"/>
</manifest>
<fileset dir="${build.dir}/@{module}/main"/>
</jar>
<jar jarfile="${build.dir}/retrofit-@{module}-${retrofit.revision}-src.jar">
<manifest>
<attribute name="Build-Time" value="${build.time}"/>
<attribute name="Copyright"
value="${build.year}, Square, Inc."/>
<attribute name="Commit-Hash" value="${commit.hash}"/>
</manifest>
<fileset dir="modules/@{module}/src"/>
</jar>
</sequential>
</macrodef>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2010 Square, Inc. -->
<!--
- Builds the Retrofit project, relying on Apache Ivy to download external
- dependencies.
-
- Retrofit is divided into modules, all of which are built from this single
- Ant buildfile. The directory structure is as follows:
-
- [project root]
- modules
- [module]
- src
- src-tests
-->
<project
xmlns:ivy="antlib:org.apache.ivy.ant"
name="Retrofit" basedir="." default="dist">
<!--
- The Retrofit version number, becomes part of the JAR file names.
-->
<property file="revision.properties"/>
<!-- Import boilerplate Ivy build steps. -->
<import file="ivy-build.xml"/>
<property name="build.dir" location="build"/>
<property name="lib.dir" location="lib"/>
<property name="testreports.dir" location="${build.dir}/testreports"/>
<target name="prepare" depends="init-ivy">
<tstamp>
<!-- ISO 8601 format: 2010-06-02T15:25:45Z -->
<format property="build.time" timezone="GMT"
pattern="yyyy-MM-dd'T'HH:mm:ss'Z'"/>
<format property="build.year" timezone="GMT"
pattern="yyyy"/>
</tstamp>
<!--
- Assigns the git commit hash to the 'commit.hash' property, sending
- errors to the Ant log.
-->
<exec executable="git"
outputproperty="commit.hash"
failifexecutionfails="false"
logerror="true">
<arg value="log"/>
<arg value="-n1"/>
<arg value="--pretty=format:%H"/>
</exec>
<!-- Downloads dependencies and places JARs under lib. -->
<ivy:retrieve/>
</target>
<target name="clean">
<delete dir="${build.dir}"/>
</target>
<target name="clean-libs" depends="clean"
description="Removes the 'lib' directory.">
<delete dir="${lib.dir}"/>
</target>
<import file="build-macros.xml"/>
<target name="repackage-gson" depends="prepare">
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask">
<classpath>
<fileset dir="lib" includes="jarjar*.jar"/>
</classpath>
</taskdef>
<jarjar jarfile="${build.dir}/retrofit-gson-2.1.jar">
<zipfileset src="lib/gson-2.1.jar"/>
<rule pattern="com.google.gson.**" result="retrofit.internal.gson.@1"/>
</jarjar>
<jarjar jarfile="${build.dir}/retrofit-gson-2.1-sources.jar">
<zipfileset src="lib/gson-2.1-sources.jar"/>
<rule pattern="com.google.gson.**" result="retrofit.internal.gson.@1"/>
</jarjar>
</target>
<target name="compile" depends="repackage-gson">
<!-- Build these in this particular order. -->
<compile.module module="core"/>
<compile.module module="io">
<compile.main.classpath>
<pathelement location="${build.dir}/core/main"/>
</compile.main.classpath>
</compile.module>
<compile.module module="http">
<compile.main.classpath>
<pathelement location="${build.dir}/core/main"/>
<pathelement location="${build.dir}/io/main"/>
<pathelement location="${build.dir}/retrofit-gson-2.1.jar"/>
</compile.main.classpath>
<compile.tests.classpath>
<pathelement location="${build.dir}/core/main"/>
<pathelement location="${build.dir}/io/main"/>
<pathelement location="${build.dir}/retrofit-gson-2.1.jar"/>
</compile.tests.classpath>
</compile.module>
<compile.module module="android"/>
</target>
<target name="jar" depends="compile">
<jar.module module="android"/>
<jar.module module="core"/>
<jar.module module="http"/>
<jar.module module="io"/>
</target>
<target name="require.tests"
description="Sets a property so test failures abort the build.">
<property name="require.tests" value="true"/>
</target>
<target name="test" depends="compile" description="Runs tests.">
<mkdir dir="${testreports.dir}"/>
<!--
- If this property isn't already set, assume broken tests should not
- abort the build.
-->
<property name="require.tests" value="false"/>
<junit printsummary="true" haltonfailure="${require.tests}">
<classpath>
<pathelement location="${build.dir}/android/main"/>
<pathelement location="${build.dir}/android/tests"/>
<pathelement location="${build.dir}/core/main"/>
<pathelement location="${build.dir}/core/tests"/>
<pathelement location="${build.dir}/http/main"/>
<pathelement location="${build.dir}/http/tests"/>
<pathelement location="${build.dir}/io/main"/>
<pathelement location="${build.dir}/io/tests"/>
<fileset dir="${build.dir}" includes="retrofit-gson*.jar"/>
<fileset dir="${lib.dir}" includes="*.jar"/>
</classpath>
<formatter type="xml"/>
<batchtest todir="${testreports.dir}">
<fileset dir="modules/android/src-tests">
<include name="**/*Test.java"/>
</fileset>
<fileset dir="modules/core/src-tests">
<include name="**/*Test.java"/>
</fileset>
<fileset dir="modules/io/src-tests">
<include name="**/*Test.java"/>
</fileset>
<fileset dir="modules/http/src-tests">
<include name="**/*Test.java"/>
</fileset>
</batchtest>
</junit>
<junitreport todir="${testreports.dir}">
<fileset dir="${testreports.dir}" includes="TEST-*.xml"/>
<report todir="${testreports.dir}"/>
</junitreport>
<echo
message="${line.separator}Test report written to:${line.separator}${testreports.dir}/index.html"/>
</target>
<!--
- Publishes to the Ivy repository using the resolver named
- 'retrofit-resolver'.
-->
<target name="publish" depends="dist">
<ivy:publish
pubrevision="${retrofit.revision}"
resolver="retrofit-resolver"
forcedeliver="true"
update="true"
overwrite="true"
publishivy="true">
<!--
- This pattern selects which files will be published. The artifact
- pattern in ivy-settings.xml controls how the names matched here are
- published in the Ivy repository.
-->
<artifacts pattern="${build.dir}/[artifact]-[revision](-[classifier]).[ext]"/>
</ivy:publish>
</target>
<target name="dist" depends="clean,require.tests,test,jar"
description="Compiles, ensures tests pass, and creates all deliverables.">
<zip zipfile="${build.dir}/retrofit-${retrofit.revision}.zip">
<zipfileset prefix="retrofit" dir=".">
<exclude name="build/**"/>
<exclude name="out/**"/>
<exclude name="lib/**"/>
<exclude name="**/.git/**"/>
<exclude name=".gitignore"/>
<exclude name=".idea/**"/>
<exclude name="*.iml"/>
</zipfileset>
<zipfileset prefix="retrofit/bin" dir="${build.dir}">
<include name="retrofit-*.jar"/>
</zipfileset>
</zip>
</target>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.squareup</groupId>
<artifactId>retrofit</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<groupId>com.squareup</groupId>
<artifactId>retrofit-core</artifactId>
<packaging>jar</packaging>
<name>Retrofit Core</name>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
// Copyright 2010 Square, Inc.
package retrofit.core.internal;
import junit.framework.TestCase;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
/** @author Eric Burke (eric@squareup.com) */
public class ObjectsTest extends TestCase {
/**
* @author Eric Burke (eric@squareup.com)
*/
public class ObjectsTest {
public void testNonNull() {
Objects.nonNull(10, "whatever");
try {
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.squareup</groupId>
<artifactId>retrofit</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<groupId>com.squareup</groupId>
<artifactId>retrofit-http</artifactId>
<packaging>jar</packaging>
<name>Retrofit HTTP</name>
<dependencies>
<dependency>
<groupId>com.squareup</groupId>
<artifactId>retrofit-io</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>jarjar-maven-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jarjar</goal>
</goals>
<configuration>
<includes>
<include>com.google.code.gson:gson</include>
</includes>
<rules>
<rule>
<pattern>com.google.gson.**</pattern>
<result>retrofit.internal.gson.@1</result>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
......@@ -5,13 +5,13 @@ import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.google.gson.Gson;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.StatusLine;
import org.apache.http.client.ResponseHandler;
import org.apache.http.entity.BufferedHttpEntity;
import retrofit.core.Callback;
import retrofit.internal.gson.Gson;
/**
* Support for response handlers that invoke {@link Callback}.
......@@ -30,7 +30,7 @@ public abstract class CallbackResponseHandler<T>
private static final int GATEWAY_TIMEOUT = 504;
private final Callback<T> callback;
private final Gson gson;
protected CallbackResponseHandler(Gson gson, Callback<T> callback) {
......
// Copyright 2010 Square, Inc.
package retrofit.http;
import com.google.gson.Gson;
import com.google.inject.Inject;
import com.google.inject.Provider;
import java.io.IOException;
......@@ -14,7 +15,6 @@ import org.apache.http.client.methods.HttpGet;
import retrofit.core.Callback;
import retrofit.core.MainThread;
import retrofit.core.ProgressListener;
import retrofit.internal.gson.Gson;
import retrofit.io.ByteSink;
import static retrofit.core.internal.Objects.nonNull;
......
package retrofit.http;
import com.google.gson.Gson;
import com.google.gson.JsonParseException;
import org.apache.http.HttpEntity;
import retrofit.core.Callback;
import retrofit.internal.gson.Gson;
import retrofit.internal.gson.JsonParseException;
import java.io.IOException;
import java.io.InputStreamReader;
......
package retrofit.http;
import com.google.gson.Gson;
import com.google.inject.name.Named;
import org.apache.http.NameValuePair;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.message.BasicNameValuePair;
import retrofit.internal.gson.Gson;
import retrofit.io.MimeType;
import retrofit.io.TypedBytes;
......
package retrofit.http;
import com.google.gson.Gson;
import com.google.inject.Binder;
import com.google.inject.Inject;
import com.google.inject.Module;
......@@ -21,7 +22,6 @@ import org.apache.http.client.ResponseHandler;
import org.apache.http.client.methods.HttpUriRequest;
import retrofit.core.Callback;
import retrofit.core.MainThread;
import retrofit.internal.gson.Gson;
/**
* Converts Java method calls to Rest calls.
......
// Copyright 2010 Square, Inc.
package retrofit.http;
import com.google.gson.Gson;
import com.google.inject.Provider;
import junit.framework.Assert;
import junit.framework.TestCase;
......@@ -13,7 +14,6 @@ import org.apache.http.client.methods.HttpUriRequest;
import retrofit.core.Callback;
import retrofit.core.MainThread;
import retrofit.core.ProgressListener;
import retrofit.internal.gson.Gson;
import retrofit.io.ByteSink;
import java.io.ByteArrayOutputStream;
......
// Copyright 2011 Square, Inc.
package retrofit.http;
import com.google.gson.Gson;
import com.google.inject.name.Named;
import java.io.ByteArrayOutputStream;
import java.lang.reflect.Method;
......@@ -13,7 +14,6 @@ import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.client.methods.HttpUriRequest;
import retrofit.core.Callback;
import retrofit.internal.gson.Gson;
/** @author Eric Denman (edenman@squareup.com) */
public class HttpRequestBuilderTest extends TestCase {
......
package retrofit.http;
import com.google.gson.Gson;
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
......@@ -24,7 +25,6 @@ import org.easymock.IAnswer;
import org.junit.Before;
import retrofit.core.Callback;
import retrofit.core.MainThread;
import retrofit.internal.gson.Gson;
import static org.easymock.EasyMock.capture;
import static org.easymock.EasyMock.createMock;
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.squareup</groupId>
<artifactId>retrofit</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<groupId>com.squareup</groupId>
<artifactId>retrofit-io</artifactId>
<packaging>jar</packaging>
<name>Retrofit I/O</name>
<dependencies>
<dependency>
<groupId>com.squareup</groupId>
<artifactId>retrofit-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.squareup</groupId>
<artifactId>retrofit-android-native</artifactId>
<version>${project.version}</version>
<type>so</type>
<classifier>armeabi</classifier>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
// Copyright 2011 Square, Inc.
package retrofit.io;
import junit.framework.TestCase;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.PrintWriter;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
/**
* @author Paul Hawke (psh@squareup.com)
*/
public class FilesTest extends TestCase {
public class FilesTest {
public void testDelete() throws Exception {
File tmpFile = File.createTempFile("prefix", ".tmp");
PrintWriter pw = new PrintWriter(new FileWriter(tmpFile));
......
// Copyright 2010 Square, Inc.
package retrofit.io;
import junit.framework.TestCase;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
/** @author Eric Burke (eric@squareup.com) */
public class TypedByteArrayTest extends TestCase {
/**
* @author Eric Burke (eric@squareup.com)
*/
public class TypedByteArrayTest {
public void testEquals() {
TypedByteArray a1 = new TypedByteArray(new byte[]{10, 20}, MimeType.GIF);
TypedByteArray a2 = new TypedByteArray(new byte[]{10, 20}, MimeType.GIF);
......
// Copyright 2010 Square, Inc.
package retrofit.io;
import junit.framework.TestCase;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
/** @author Eric Burke (eric@squareup.com) */
public class TypedFileTest extends TestCase {
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
/**
* @author Eric Burke (eric@squareup.com)
*/
public class TypedFileTest {
public void testNotEquals() {
TypedFile a = new TypedFile(new File("a.png"), MimeType.PNG);
TypedFile b = new TypedFile(new File("b.png"), MimeType.PNG);
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2010 Square, Inc. -->
<!--
- Ivy boilerplate build steps, helps keep the main buildfile clean.
-->
<project xmlns:ivy="antlib:org.apache.ivy.ant"
name="ivy-build" basedir="." default="init-ivy">
<property name="ivy.install.version" value="2.2.0"/>
<condition property="ivy.home" value="${env.IVY_HOME}">
<isset property="env.IVY_HOME"/>
</condition>
<property name="ivy.home" value="${user.home}/.ant"/>
<property name="ivy.jar.dir" value="${ivy.home}/lib"/>
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar"/>
<!--
- Gets Ivy from the public Maven repo so we don't need a custom Ant
- installation.
-->
<target name="download-ivy" unless="offline">
<mkdir dir="${ivy.jar.dir}"/>
<get
src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.jar.file}" usetimestamp="true"/>
</target>
<target name="init-ivy" depends="download-ivy">
<!--
- Try to load ivy here from ivy home, in case the user has not already
- dropped it into ant's lib dir (note that the latter copy will always
- take precedence). We will not fail as long as local lib dir exists (it
- may be empty) and ivy is in at least one of ant's lib dir or the local
- lib dir.
-->
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
<ivy:configure file="ivy-settings.xml"/>
</target>
</project>
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2010 Square, Inc. -->
<!--
- Configures the Ivy resolver. The Ant build file references this using the
- <ivy:configure file="ivy-settings.xml"/> tag.
-
- @author Eric Burke (eric@squareup.com)
-->
<ivysettings>
<settings defaultResolver="retrofit-resolver"/>
<resolvers>
<chain name="retrofit-resolver">
<filesystem name="libraries">
<!--
- This pattern controls how artifacts are named when published to
- the repository.
-->
<artifact pattern="${ivy.default.ivy.user.dir}/repository/[artifact]-[revision](-[classifier]).[ext]"/>
</filesystem>
<ibiblio name="ibiblio" m2compatible="true"/>
</chain>
</resolvers>
</ivysettings>
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2010 Square, Inc. -->
<!--
- Ivy module file, describing dependencies on other projects.
-
- @author Eric Burke (eric@squareup.com)
-->
<ivy-module
version="2.0"
xmlns:e="http://ant.apache.org/ivy/extra"
>
<info organisation="com.squareup" module="retrofit"/>
<configurations>
<conf name="android" description="Classes with Android dependencies."/>
</configurations>
<publications>
<artifact conf="android" name="retrofit-android" ext="jar"/>
<artifact conf="android" name="retrofit-android" ext="jar" e:classifier="src"/>
</publications>
<!-- Note: find these at http://mvnrepository.com/ -->
<dependencies>
<dependency org="com.google.android" name="android-test" rev="2.2.1"/>
<dependency org="com.google.code.gson" name="gson" rev="2.1"/>
<dependency org="com.googlecode.jarjar" name="jarjar" rev="1.1"/>
<dependency org="com.google.code.guice" name="guice" rev="1.0"/>
<dependency org="org.apache.httpcomponents" name="httpmime" rev="4.1-alpha1"/>
<dependency org="junit" name="junit" rev="4.8.1"/>
<dependency org="org.apache.httpcomponents" name="httpclient" rev="4.1-alpha1"/>
<dependency org="org.easymock" name="easymock" rev="2.5.2"/>
</dependencies>
</ivy-module>
The native portions of Retofit's Android module live in ./jni.
Building:
./build-jni.sh
Installation:
Copy ./libs to your Android project root.
Testing:
Run test_app on a device or emulator.
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src-tests" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="JARs" level="project" />
</component>
</module>
#!/bin/sh
if [ ! -d android-ndk ]
then
echo Downloading Android NDK...
curl http://dl.google.com/android/ndk/android-ndk-r5b-darwin-x86.tar.bz2 > /tmp/android-ndk.tgz
echo Extracting Android NDK...
tar zxf /tmp/android-ndk.tgz -C /tmp
mv /tmp/android-ndk-r5b ./android-ndk
fi
./android-ndk/ndk-build
# This file is used to override default values used by the Ant build system.
#
# This file must be checked in Version Control Systems, as it is
# integral to the build system of your project.
# This file is only used by the Ant script.
# You can use this to override default values such as
# 'source.dir' for the location of your java source folder and
# 'out.dir' for the location of your output folder.
# You can also use it define how the release builds are signed by declaring
# the following properties:
# 'key.store' for the location of your keystore and
# 'key.alias' for the name of the key to use.
# The password will be asked during the build when you use the 'release' target.
<?xml version="1.0" encoding="UTF-8"?>
<project name="test_app" default="help">
<target name="-pre-build">
<mkdir dir="libs"/>
<!-- Copy native library. -->
<copy todir="libs/armeabi">
<fileset dir="../libs/armeabi"/>
</copy>
<!-- Copy Retrofit's Java library. -->
<copy todir="libs">
<fileset dir="../../../build" includes="retrofit-io*.jar"
excludes="*src*"/>
</copy>
</target>
<!-- The local.properties file is created and updated by the 'android'
tool.
It contains the path to the SDK. It should *NOT* be checked into
Version Control Systems. -->
<property file="local.properties" />
<!-- The build.properties file can be created by you and is never touched
by the 'android' tool. This is the place to change some of the
default property values used by the Ant rules.
Here are some properties you may want to change/update:
source.dir
The name of the source directory. Default is 'src'.
out.dir
The name of the output directory. Default is 'bin'.
Properties related to the SDK location or the project target should
be updated using the 'android' tool with the 'update' action.
This file is an integral part of the build system for your
application and should be checked into Version Control Systems.
-->
<property file="build.properties" />
<!-- The default.properties file is created and updated by the 'android'
tool, as well as ADT.
This file is an integral part of the build system for your
application and should be checked into Version Control Systems. -->
<property file="default.properties" />
<!-- Required pre-setup import -->
<import file="${sdk.dir}/tools/ant/pre_setup.xml" />
<!-- extension targets. Uncomment the ones where you want to do custom work
in between standard targets -->
<!--
<target name="-pre-build">
</target>
<target name="-pre-compile">
</target>
[This is typically used for code obfuscation.
Compiled code location: ${out.classes.absolute.dir}
If this is not done in place, override ${out.dex.input.absolute.dir}]
<target name="-post-compile">
</target>
-->
<!-- Execute the Android Setup task that will setup some properties
specific to the target, and import the build rules files.
The rules file is imported from
<SDK>/tools/ant/
Depending on the project type it can be either:
- main_rules.xml
- lib_rules.xml
- test_rules.xml
To customize existing targets, there are two options:
- Customize only one target:
- copy/paste the target into this file, *before* the
<setup> task.
- customize it to your needs.
- Customize the whole script.
- copy/paste the content of the rules files (minus the top node)
into this file, *after* the <setup> task
- disable the import of the rules by changing the setup task
below to <setup import="false" />.
- customize to your needs.
-->
<setup />
</project>
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "build.properties", and override values to adapt the script to your
# project structure.
# Project target.
target=android-10
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked in Version Control Systems,
# as it contains information specific to your local configuration.
# location of the SDK. This is only used by Ant
# For customization when using a Version Control System, please read the
# header note.
sdk.dir=${user.home}/android-sdk
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" />
</content>
<orderEntry type="jdk" jdkName="Android" jdkType="JavaSDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="io" />
</component>
</module>
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src-tests" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="JARs" level="project" />
</component>
</module>
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src-tests" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="io" exported="" />
</component>
</module>
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src-tests" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="core" exported="" />
</component>
</module>
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2012 Square, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.squareup</groupId>
<artifactId>retrofit</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Retrofit</name>
<description></description>
<url>http://github.com/square/retrofit/</url>
<modules>
<module>core</module>
<module>http</module>
<module>io</module>
<module>android</module>
<module>android-native</module>
<module>sample-android</module>
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.sourceEncoding>UTF-8</project.reporting.sourceEncoding>
<!-- Compilation -->
<android-maven.version>3.1.1</android-maven.version>
<java.version>1.6</java.version>
<jarjar.version>1.1</jarjar.version>
<!-- Dependencies -->
<android.version>2.2.1</android.version>
<gson.version>2.1</gson.version>
<guice.version>3.0</guice.version>
<httpcomponents.version>4.1.3</httpcomponents.version>
<!-- Test Dependencies -->
<junit.version>4.10</junit.version>
<easymock.version>3.1</easymock.version>
</properties>
<scm>
<url>http://github.com/square/retrofit</url>
<connection>scm:git:git://github.com/square/retrofit.git</connection>
<developerConnection>scm:git:ssh://git@github.com/square/retrofit.git</developerConnection>
</scm>
<issueManagement>
<system>GitHub Issues</system>
<url>http://github.com/square/retrofit/issues</url>
</issueManagement>
<licenses>
<license>
<name>Apache 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<organization>
<name>Square, Inc.</name>
<url>http://squareup.com</url>
</organization>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>${android.version}</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson.version}</version>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>${guice.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>${httpcomponents.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>${httpcomponents.version}</version>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<version>${easymock.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>${android-maven.version}</version>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>jarjar-maven-plugin</artifactId>
<version>1.5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
</configuration>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
retrofit.revision=0.6-SNAPSHOT
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.squareup</groupId>
<artifactId>retrofit</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<groupId>com.squareup</groupId>
<artifactId>retrofit-sample-android</artifactId>
<packaging>apk</packaging>
<name>Retrofit Sample: Android</name>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.squareup</groupId>
<artifactId>retrofit-android</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.squareup</groupId>
<artifactId>retrofit-io</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册