Ver código fonte

init

tags/v0.2.1
Robin Thoni 8 anos atrás
commit
b0f300c5bf
37 arquivos alterados com 2529 adições e 0 exclusões
  1. 45
    0
      .gitignore
  2. 36
    0
      build.gradle
  3. 18
    0
      gradle.properties
  4. BIN
      gradle/wrapper/gradle-wrapper.jar
  5. 6
    0
      gradle/wrapper/gradle-wrapper.properties
  6. 160
    0
      gradlew
  7. 90
    0
      gradlew.bat
  8. 1
    0
      luticateutils/.gitignore
  9. 36
    0
      luticateutils/build.gradle
  10. 17
    0
      luticateutils/proguard-rules.pro
  11. 5
    0
      luticateutils/src/main/AndroidManifest.xml
  12. 7
    0
      luticateutils/src/main/java/com/luticate/utils/business/LuBusiness.java
  13. 9
    0
      luticateutils/src/main/java/com/luticate/utils/business/LuConsumer.java
  14. 9
    0
      luticateutils/src/main/java/com/luticate/utils/business/LuConverter.java
  15. 128
    0
      luticateutils/src/main/java/com/luticate/utils/business/LuPromise.java
  16. 37
    0
      luticateutils/src/main/java/com/luticate/utils/dataaccess/LuDataAccess.java
  17. 167
    0
      luticateutils/src/main/java/com/luticate/utils/dataaccess/LuRequest.java
  18. 20
    0
      luticateutils/src/main/java/com/luticate/utils/dbo/JSONContainer/LuAbstractJsonContainer.java
  19. 58
    0
      luticateutils/src/main/java/com/luticate/utils/dbo/JSONContainer/LuJSONArrayContainer.java
  20. 59
    0
      luticateutils/src/main/java/com/luticate/utils/dbo/JSONContainer/LuJSONObjectContainer.java
  21. 26
    0
      luticateutils/src/main/java/com/luticate/utils/dbo/LuBoolDbo.java
  22. 57
    0
      luticateutils/src/main/java/com/luticate/utils/dbo/LuDataAccessConfigDbo.java
  23. 272
    0
      luticateutils/src/main/java/com/luticate/utils/dbo/LuDbo.java
  24. 27
    0
      luticateutils/src/main/java/com/luticate/utils/dbo/LuDoubleDbo.java
  25. 27
    0
      luticateutils/src/main/java/com/luticate/utils/dbo/LuIntDbo.java
  26. 27
    0
      luticateutils/src/main/java/com/luticate/utils/dbo/LuLongDbo.java
  27. 66
    0
      luticateutils/src/main/java/com/luticate/utils/dbo/LuPaginatedDbo.java
  28. 44
    0
      luticateutils/src/main/java/com/luticate/utils/dbo/LuPromiseError.java
  29. 27
    0
      luticateutils/src/main/java/com/luticate/utils/dbo/LuStringDbo.java
  30. 7
    0
      luticateutils/src/main/java/com/luticate/utils/dbo/LuVoidDbo.java
  31. 222
    0
      luticateutils/src/test/java/com/luticate/utils/BasicDboTest.java
  32. 35
    0
      luticateutils/src/test/java/com/luticate/utils/NameDboTest.java
  33. 181
    0
      luticateutils/src/test/java/com/luticate/utils/PromiseTest.java
  34. 49
    0
      luticateutils/src/test/java/com/luticate/utils/Test2Dbo.java
  35. 365
    0
      luticateutils/src/test/java/com/luticate/utils/TestDbo.java
  36. 188
    0
      luticateutils/src/test/java/com/luticate/utils/TestDboTest.java
  37. 1
    0
      settings.gradle

+ 45
- 0
.gitignore Ver arquivo

@@ -0,0 +1,45 @@
1
+.DS_Store
2
+
3
+# Built application files
4
+*.apk
5
+*.ap_
6
+
7
+# Files for the ART/Dalvik VM
8
+*.dex
9
+
10
+# Java class files
11
+*.class
12
+
13
+# Generated files
14
+bin/
15
+gen/
16
+out/
17
+
18
+# Gradle files
19
+.gradle/
20
+build/
21
+
22
+# Local configuration file (sdk path, etc)
23
+local.properties
24
+
25
+# Proguard folder generated by Eclipse
26
+proguard/
27
+
28
+# Log Files
29
+*.log
30
+
31
+# Android Studio Navigation editor temp files
32
+.navigation/
33
+
34
+# Android Studio captures folder
35
+captures/
36
+
37
+# Intellij
38
+*.iml
39
+.idea
40
+
41
+# Keystore files
42
+*.jks
43
+
44
+# External native build folder generated in Android Studio 2.2 and later
45
+.externalNativeBuild

+ 36
- 0
build.gradle Ver arquivo

@@ -0,0 +1,36 @@
1
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
2
+
3
+buildscript {
4
+    repositories {
5
+        jcenter()
6
+        mavenCentral()
7
+        maven {
8
+            url 'http://dl.bintray.com/amulyakhare/maven'
9
+        }
10
+        maven {
11
+            url 'https://maven.rthoni.com'
12
+        }
13
+    }
14
+    dependencies {
15
+        classpath 'com.android.tools.build:gradle:2.2.2'
16
+        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
17
+        classpath 'com.google.gms:google-services:3.0.0'
18
+        classpath 'de.mobilej.unmock:UnMockPlugin:0.5.0'
19
+
20
+        // NOTE: Do not place your application dependencies here; they belong
21
+        // in the individual module build.gradle files
22
+    }
23
+}
24
+
25
+allprojects {
26
+    repositories {
27
+        jcenter()
28
+        maven {
29
+            url 'https://jitpack.io'
30
+        }
31
+    }
32
+}
33
+
34
+task clean(type: Delete) {
35
+    delete rootProject.buildDir
36
+}

+ 18
- 0
gradle.properties Ver arquivo

@@ -0,0 +1,18 @@
1
+# Project-wide Gradle settings.
2
+
3
+# IDE (e.g. Android Studio) users:
4
+# Gradle settings configured through the IDE *will override*
5
+# any settings specified in this file.
6
+
7
+# For more details on how to configure your build environment visit
8
+# http://www.gradle.org/docs/current/userguide/build_environment.html
9
+
10
+# Specifies the JVM arguments used for the daemon process.
11
+# The setting is particularly useful for tweaking memory settings.
12
+# Default value: -Xmx10248m -XX:MaxPermSize=256m
13
+# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14
+
15
+# When configured, Gradle will run in incubating parallel mode.
16
+# This option should only be used with decoupled projects. More details, visit
17
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18
+# org.gradle.parallel=true

BIN
gradle/wrapper/gradle-wrapper.jar Ver arquivo


+ 6
- 0
gradle/wrapper/gradle-wrapper.properties Ver arquivo

@@ -0,0 +1,6 @@
1
+#Thu Sep 29 16:53:12 EDT 2016
2
+distributionBase=GRADLE_USER_HOME
3
+distributionPath=wrapper/dists
4
+zipStoreBase=GRADLE_USER_HOME
5
+zipStorePath=wrapper/dists
6
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip

+ 160
- 0
gradlew Ver arquivo

@@ -0,0 +1,160 @@
1
+#!/usr/bin/env bash
2
+
3
+##############################################################################
4
+##
5
+##  Gradle start up script for UN*X
6
+##
7
+##############################################################################
8
+
9
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10
+DEFAULT_JVM_OPTS=""
11
+
12
+APP_NAME="Gradle"
13
+APP_BASE_NAME=`basename "$0"`
14
+
15
+# Use the maximum available, or set MAX_FD != -1 to use that value.
16
+MAX_FD="maximum"
17
+
18
+warn ( ) {
19
+    echo "$*"
20
+}
21
+
22
+die ( ) {
23
+    echo
24
+    echo "$*"
25
+    echo
26
+    exit 1
27
+}
28
+
29
+# OS specific support (must be 'true' or 'false').
30
+cygwin=false
31
+msys=false
32
+darwin=false
33
+case "`uname`" in
34
+  CYGWIN* )
35
+    cygwin=true
36
+    ;;
37
+  Darwin* )
38
+    darwin=true
39
+    ;;
40
+  MINGW* )
41
+    msys=true
42
+    ;;
43
+esac
44
+
45
+# Attempt to set APP_HOME
46
+# Resolve links: $0 may be a link
47
+PRG="$0"
48
+# Need this for relative symlinks.
49
+while [ -h "$PRG" ] ; do
50
+    ls=`ls -ld "$PRG"`
51
+    link=`expr "$ls" : '.*-> \(.*\)$'`
52
+    if expr "$link" : '/.*' > /dev/null; then
53
+        PRG="$link"
54
+    else
55
+        PRG=`dirname "$PRG"`"/$link"
56
+    fi
57
+done
58
+SAVED="`pwd`"
59
+cd "`dirname \"$PRG\"`/" >/dev/null
60
+APP_HOME="`pwd -P`"
61
+cd "$SAVED" >/dev/null
62
+
63
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64
+
65
+# Determine the Java command to use to start the JVM.
66
+if [ -n "$JAVA_HOME" ] ; then
67
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68
+        # IBM's JDK on AIX uses strange locations for the executables
69
+        JAVACMD="$JAVA_HOME/jre/sh/java"
70
+    else
71
+        JAVACMD="$JAVA_HOME/bin/java"
72
+    fi
73
+    if [ ! -x "$JAVACMD" ] ; then
74
+        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75
+
76
+Please set the JAVA_HOME variable in your environment to match the
77
+location of your Java installation."
78
+    fi
79
+else
80
+    JAVACMD="java"
81
+    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82
+
83
+Please set the JAVA_HOME variable in your environment to match the
84
+location of your Java installation."
85
+fi
86
+
87
+# Increase the maximum file descriptors if we can.
88
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89
+    MAX_FD_LIMIT=`ulimit -H -n`
90
+    if [ $? -eq 0 ] ; then
91
+        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92
+            MAX_FD="$MAX_FD_LIMIT"
93
+        fi
94
+        ulimit -n $MAX_FD
95
+        if [ $? -ne 0 ] ; then
96
+            warn "Could not set maximum file descriptor limit: $MAX_FD"
97
+        fi
98
+    else
99
+        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100
+    fi
101
+fi
102
+
103
+# For Darwin, add options to specify how the application appears in the dock
104
+if $darwin; then
105
+    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106
+fi
107
+
108
+# For Cygwin, switch paths to Windows format before running java
109
+if $cygwin ; then
110
+    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111
+    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112
+    JAVACMD=`cygpath --unix "$JAVACMD"`
113
+
114
+    # We build the pattern for arguments to be converted via cygpath
115
+    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116
+    SEP=""
117
+    for dir in $ROOTDIRSRAW ; do
118
+        ROOTDIRS="$ROOTDIRS$SEP$dir"
119
+        SEP="|"
120
+    done
121
+    OURCYGPATTERN="(^($ROOTDIRS))"
122
+    # Add a user-defined pattern to the cygpath arguments
123
+    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124
+        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125
+    fi
126
+    # Now convert the arguments - kludge to limit ourselves to /bin/sh
127
+    i=0
128
+    for arg in "$@" ; do
129
+        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130
+        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
131
+
132
+        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
133
+            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134
+        else
135
+            eval `echo args$i`="\"$arg\""
136
+        fi
137
+        i=$((i+1))
138
+    done
139
+    case $i in
140
+        (0) set -- ;;
141
+        (1) set -- "$args0" ;;
142
+        (2) set -- "$args0" "$args1" ;;
143
+        (3) set -- "$args0" "$args1" "$args2" ;;
144
+        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145
+        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146
+        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147
+        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148
+        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149
+        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150
+    esac
151
+fi
152
+
153
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154
+function splitJvmOpts() {
155
+    JVM_OPTS=("$@")
156
+}
157
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159
+
160
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

+ 90
- 0
gradlew.bat Ver arquivo

@@ -0,0 +1,90 @@
1
+@if "%DEBUG%" == "" @echo off
2
+@rem ##########################################################################
3
+@rem
4
+@rem  Gradle startup script for Windows
5
+@rem
6
+@rem ##########################################################################
7
+
8
+@rem Set local scope for the variables with windows NT shell
9
+if "%OS%"=="Windows_NT" setlocal
10
+
11
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12
+set DEFAULT_JVM_OPTS=
13
+
14
+set DIRNAME=%~dp0
15
+if "%DIRNAME%" == "" set DIRNAME=.
16
+set APP_BASE_NAME=%~n0
17
+set APP_HOME=%DIRNAME%
18
+
19
+@rem Find java.exe
20
+if defined JAVA_HOME goto findJavaFromJavaHome
21
+
22
+set JAVA_EXE=java.exe
23
+%JAVA_EXE% -version >NUL 2>&1
24
+if "%ERRORLEVEL%" == "0" goto init
25
+
26
+echo.
27
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28
+echo.
29
+echo Please set the JAVA_HOME variable in your environment to match the
30
+echo location of your Java installation.
31
+
32
+goto fail
33
+
34
+:findJavaFromJavaHome
35
+set JAVA_HOME=%JAVA_HOME:"=%
36
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37
+
38
+if exist "%JAVA_EXE%" goto init
39
+
40
+echo.
41
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42
+echo.
43
+echo Please set the JAVA_HOME variable in your environment to match the
44
+echo location of your Java installation.
45
+
46
+goto fail
47
+
48
+:init
49
+@rem Get command-line arguments, handling Windowz variants
50
+
51
+if not "%OS%" == "Windows_NT" goto win9xME_args
52
+if "%@eval[2+2]" == "4" goto 4NT_args
53
+
54
+:win9xME_args
55
+@rem Slurp the command line arguments.
56
+set CMD_LINE_ARGS=
57
+set _SKIP=2
58
+
59
+:win9xME_args_slurp
60
+if "x%~1" == "x" goto execute
61
+
62
+set CMD_LINE_ARGS=%*
63
+goto execute
64
+
65
+:4NT_args
66
+@rem Get arguments from the 4NT Shell from JP Software
67
+set CMD_LINE_ARGS=%$
68
+
69
+:execute
70
+@rem Setup the command line
71
+
72
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73
+
74
+@rem Execute Gradle
75
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76
+
77
+:end
78
+@rem End local scope for the variables with windows NT shell
79
+if "%ERRORLEVEL%"=="0" goto mainEnd
80
+
81
+:fail
82
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83
+rem the _cmd.exe /c_ return code!
84
+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85
+exit /b 1
86
+
87
+:mainEnd
88
+if "%OS%"=="Windows_NT" endlocal
89
+
90
+:omega

+ 1
- 0
luticateutils/.gitignore Ver arquivo

@@ -0,0 +1 @@
1
+/build

+ 36
- 0
luticateutils/build.gradle Ver arquivo

@@ -0,0 +1,36 @@
1
+apply plugin: 'com.android.library'
2
+apply plugin: 'de.mobilej.unmock'
3
+
4
+android {
5
+    compileSdkVersion 22
6
+    buildToolsVersion "22.0.1"
7
+
8
+    defaultConfig {
9
+        minSdkVersion 14
10
+        targetSdkVersion 22
11
+        versionCode 1
12
+        versionName "0.2.0"
13
+    }
14
+    buildTypes {
15
+        release {
16
+            minifyEnabled false
17
+            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18
+        }
19
+    }
20
+}
21
+
22
+unMock {
23
+    // URI to download the android-all.jar from. e.g. https://oss.sonatype.org/content/groups/public/org/robolectric/android-all/
24
+    downloadFrom 'https://oss.sonatype.org/content/groups/public/org/robolectric/android-all/4.3_r2-robolectric-0/android-all-4.3_r2-robolectric-0.jar'
25
+
26
+    keepStartingWith "org.json."
27
+
28
+    keep "android.util.Base64"
29
+}
30
+
31
+dependencies {
32
+    compile fileTree(dir: 'libs', include: ['*.jar'])
33
+    testCompile 'junit:junit:4.12'
34
+    compile 'com.android.volley:volley:1.0.0'
35
+    compile 'net.danlew:android.joda:2.9.4.2'
36
+}

+ 17
- 0
luticateutils/proguard-rules.pro Ver arquivo

@@ -0,0 +1,17 @@
1
+# Add project specific ProGuard rules here.
2
+# By default, the flags in this file are appended to flags specified
3
+# in /home/robin/Android/Sdk/tools/proguard/proguard-android.txt
4
+# You can edit the include path and order by changing the proguardFiles
5
+# directive in build.gradle.
6
+#
7
+# For more details, see
8
+#   http://developer.android.com/guide/developing/tools/proguard.html
9
+
10
+# Add any project specific keep options here:
11
+
12
+# If your project uses WebView with JS, uncomment the following
13
+# and specify the fully qualified class name to the JavaScript interface
14
+# class:
15
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16
+#   public *;
17
+#}

+ 5
- 0
luticateutils/src/main/AndroidManifest.xml Ver arquivo

@@ -0,0 +1,5 @@
1
+<manifest package="com.luticate.utils">
2
+
3
+    <application />
4
+
5
+</manifest>

+ 7
- 0
luticateutils/src/main/java/com/luticate/utils/business/LuBusiness.java Ver arquivo

@@ -0,0 +1,7 @@
1
+package com.luticate.utils.business;
2
+
3
+/**
4
+ * Created by robin on 11/27/15.
5
+ */
6
+public abstract class LuBusiness {
7
+}

+ 9
- 0
luticateutils/src/main/java/com/luticate/utils/business/LuConsumer.java Ver arquivo

@@ -0,0 +1,9 @@
1
+package com.luticate.utils.business;
2
+
3
+/**
4
+ * Created by robin on 10/22/16.
5
+ */
6
+
7
+public interface LuConsumer<T> {
8
+    void execute(T data);
9
+}

+ 9
- 0
luticateutils/src/main/java/com/luticate/utils/business/LuConverter.java Ver arquivo

@@ -0,0 +1,9 @@
1
+package com.luticate.utils.business;
2
+
3
+/**
4
+ * Created by robin on 10/22/16.
5
+ */
6
+
7
+public interface LuConverter<T, T2> {
8
+    T2 convert(T data);
9
+}

+ 128
- 0
luticateutils/src/main/java/com/luticate/utils/business/LuPromise.java Ver arquivo

@@ -0,0 +1,128 @@
1
+package com.luticate.utils.business;
2
+
3
+import com.luticate.utils.dbo.LuPromiseError;
4
+
5
+import java.util.List;
6
+import java.util.Vector;
7
+
8
+/**
9
+ *
10
+ * Created by robin on 11/27/15.
11
+ */
12
+public class LuPromise<T> {
13
+
14
+    public enum LuPromiseStatus {
15
+        Running,
16
+        Resolved,
17
+        Failed
18
+    }
19
+
20
+    private List<LuConsumer<T>> _onSuccess = new Vector<>();
21
+
22
+    private List<LuConsumer<LuPromiseError>> _onFailed = new Vector<>();
23
+
24
+    protected LuPromiseStatus _status = LuPromiseStatus.Running;
25
+
26
+    protected T _data = null;
27
+
28
+    protected LuPromiseError _error = null;
29
+
30
+    public LuPromiseStatus getStatus()
31
+    {
32
+        return _status;
33
+    }
34
+
35
+    public T getData()
36
+    {
37
+        return _data;
38
+    }
39
+
40
+    public LuPromiseError getError()
41
+    {
42
+        return _error;
43
+    }
44
+
45
+    public LuPromise<T> then(LuConsumer<T> onSuccess, LuConsumer<LuPromiseError> onFailed)
46
+    {
47
+        _onFailed.add(onFailed);
48
+        if (_status == LuPromiseStatus.Failed) {
49
+            if (onFailed != null) {
50
+                onFailed.execute(_error);
51
+            }
52
+        }
53
+        return then(onSuccess);
54
+    }
55
+
56
+    public LuPromise<T> then(LuConsumer<T> onSuccess)
57
+    {
58
+        _onSuccess.add(onSuccess);
59
+        if (_status == LuPromiseStatus.Resolved) {
60
+            if (onSuccess != null) {
61
+                onSuccess.execute(_data);
62
+            }
63
+        }
64
+        return this;
65
+    }
66
+
67
+    public LuPromise<T> resolve(T data)
68
+    {
69
+        if (_status == LuPromiseStatus.Running) {
70
+            _data = data;
71
+            _error = null;
72
+            _status = LuPromiseStatus.Resolved;
73
+            onSuccess();
74
+        }
75
+        return this;
76
+    }
77
+
78
+    public LuPromise<T> reject(LuPromiseError error)
79
+    {
80
+        if (_status == LuPromiseStatus.Running) {
81
+            _data = null;
82
+            _error = error;
83
+            _status = LuPromiseStatus.Failed;
84
+            onFailed();
85
+        }
86
+        return this;
87
+    }
88
+
89
+    public <T2> LuPromise<T2> map(final LuConverter<T, T2> converter)
90
+    {
91
+        final LuPromise<T2> promise = new LuPromise<>();
92
+        then(new LuConsumer<T>() {
93
+            @Override
94
+            public void execute(T data) {
95
+                promise.resolve(converter.convert(data));
96
+            }
97
+        }, getRejectConsumer());
98
+        return promise;
99
+    }
100
+
101
+    public LuConsumer<LuPromiseError> getRejectConsumer()
102
+    {
103
+        return new LuConsumer<LuPromiseError>() {
104
+            @Override
105
+            public void execute(LuPromiseError error) {
106
+                reject(error);
107
+            }
108
+        };
109
+    }
110
+
111
+    protected void onSuccess()
112
+    {
113
+        for (LuConsumer<T> c : _onSuccess) {
114
+            if (c != null) {
115
+                c.execute(_data);
116
+            }
117
+        }
118
+    }
119
+
120
+    protected void onFailed()
121
+    {
122
+        for (LuConsumer<LuPromiseError> c : _onFailed) {
123
+            if (c != null) {
124
+                c.execute(_error);
125
+            }
126
+        }
127
+    }
128
+}

+ 37
- 0
luticateutils/src/main/java/com/luticate/utils/dataaccess/LuDataAccess.java Ver arquivo

@@ -0,0 +1,37 @@
1
+package com.luticate.utils.dataaccess;
2
+
3
+import com.luticate.utils.business.LuPromise;
4
+import com.luticate.utils.dbo.LuDataAccessConfigDbo;
5
+import com.luticate.utils.dbo.LuDbo;
6
+
7
+import java.util.HashMap;
8
+
9
+/**
10
+ * Created by robin on 11/27/15.
11
+ */
12
+public abstract class LuDataAccess {
13
+
14
+    public static <T extends LuDbo> LuPromise<T> get(final LuDataAccessConfigDbo config, Class<T> type,
15
+                                                     String url, final HashMap<String, String> getParams)
16
+    {
17
+        return LuRequest.get(config, type, url, getParams);
18
+    }
19
+
20
+    public static <T extends LuDbo> LuPromise<T> get(LuDataAccessConfigDbo config, Class<T> type,
21
+                                                     String url)
22
+    {
23
+        return LuRequest.get(config, type, url);
24
+    }
25
+
26
+    public static <T extends LuDbo> LuPromise<T> post(LuDataAccessConfigDbo config, Class<T> type,
27
+                                                      String url, final HashMap<String, String> postParams)
28
+    {
29
+        return LuRequest.post(config, type, url, postParams);
30
+    }
31
+
32
+    public static <T extends LuDbo> LuPromise<T> post(LuDataAccessConfigDbo config, Class<T> type,
33
+                                                      String url)
34
+    {
35
+        return LuRequest.post(config, type, url);
36
+    }
37
+}

+ 167
- 0
luticateutils/src/main/java/com/luticate/utils/dataaccess/LuRequest.java Ver arquivo

@@ -0,0 +1,167 @@
1
+package com.luticate.utils.dataaccess;
2
+
3
+import android.content.Context;
4
+import android.net.Uri;
5
+
6
+import com.android.volley.DefaultRetryPolicy;
7
+import com.android.volley.Request;
8
+import com.android.volley.RequestQueue;
9
+import com.android.volley.Response;
10
+import com.android.volley.VolleyError;
11
+import com.android.volley.toolbox.StringRequest;
12
+import com.android.volley.toolbox.Volley;
13
+import com.luticate.utils.business.LuPromise;
14
+import com.luticate.utils.dbo.LuDataAccessConfigDbo;
15
+import com.luticate.utils.dbo.LuDbo;
16
+import com.luticate.utils.dbo.LuPromiseError;
17
+
18
+import org.json.JSONObject;
19
+
20
+import java.util.HashMap;
21
+import java.util.Map;
22
+
23
+/**
24
+ *
25
+ * Created by robin on 11/27/15.
26
+ */
27
+public class LuRequest {
28
+
29
+    private static RequestQueue _requestQueue = null;
30
+
31
+    public static void init(Context ctx)
32
+    {
33
+        _requestQueue = Volley.newRequestQueue(ctx.getApplicationContext());
34
+    }
35
+
36
+    protected static <T extends LuDbo> Response.Listener<String> getListener(final Class<T> type, final LuPromise<T> promise)
37
+    {
38
+        return new Response.Listener<String>()
39
+        {
40
+            @Override
41
+            public void onResponse(String response) {
42
+                try {
43
+                    T dbo = type.newInstance();
44
+                    JSONObject json = new JSONObject(response);
45
+                    JSONObject obj = null;
46
+                    if (json.has("data")) {
47
+                        obj = json.optJSONObject("data");
48
+                        if (obj == null) {
49
+                            obj = new JSONObject();
50
+                            obj.put("value", json.opt("data"));
51
+                        }
52
+                    }
53
+                    dbo.fromJson(obj);
54
+                    promise.resolve(dbo);
55
+                } catch (Exception e)
56
+                {
57
+                    e.printStackTrace();
58
+                    promise.reject(new LuPromiseError("Failed to parse success server response", 200));
59
+                }
60
+            }
61
+        };
62
+    }
63
+
64
+    protected static <T extends LuDbo> Response.ErrorListener getErrorListener(final LuPromise<T> promise)
65
+    {
66
+        return new Response.ErrorListener() {
67
+            @Override
68
+            public void onErrorResponse(VolleyError error) {
69
+                int code = 0;
70
+                try
71
+                {
72
+                    if (error != null) {
73
+                        if (error.networkResponse != null)
74
+                        {
75
+                            code = error.networkResponse.statusCode;
76
+                            JSONObject data = new JSONObject(new String(error.networkResponse.data));
77
+                            promise.reject(new LuPromiseError(data.getString("message"), code));
78
+                        }
79
+                        else {
80
+                            if (error.getCause() != null) {
81
+                                promise.reject(new LuPromiseError(error.getCause().getMessage(), code));
82
+                            }
83
+                            else {
84
+                                promise.reject(new LuPromiseError(error.toString(), code));
85
+                            }
86
+                        }
87
+                    }
88
+                    else {
89
+                        promise.reject(new LuPromiseError("Unknown network error", code));
90
+                    }
91
+                } catch (Exception e)
92
+                {
93
+                    promise.reject(new LuPromiseError(e.getMessage(), code));
94
+                }
95
+            }
96
+        };
97
+    }
98
+
99
+    protected static <T extends LuDbo> LuPromise<T> request(final LuDataAccessConfigDbo config,
100
+                                                            int method, Class<T> type, String url,
101
+                                                            final HashMap<String, String> params)
102
+    {
103
+        LuPromise<T> promise = new LuPromise<>();
104
+        StringRequest request = new StringRequest(method, config.getBaseUrl() + url,
105
+                getListener(type, promise), getErrorListener(promise))
106
+        {
107
+            @Override
108
+            public String getBodyContentType() {
109
+                return "application/x-www-form-urlencoded; charset=UTF-8";
110
+            }
111
+
112
+            @Override
113
+            protected Map<String, String> getParams() {
114
+                return params;
115
+            }
116
+
117
+            @Override
118
+            public Map<String, String> getHeaders() {
119
+                return config.getHeaders();
120
+            }
121
+        };
122
+        request.setRetryPolicy(new DefaultRetryPolicy(10000,
123
+                DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
124
+                DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
125
+        _requestQueue.add(request);
126
+        return promise;
127
+    }
128
+
129
+    public static <T extends LuDbo> LuPromise<T> get(final LuDataAccessConfigDbo config, Class<T> type,
130
+                                                     String url, final HashMap<String, String> getParams)
131
+    {
132
+        Uri.Builder uri = Uri.parse(url).buildUpon();
133
+        for (String key : getParams.keySet())
134
+        {
135
+            uri.appendQueryParameter(key, getParams.get(key));
136
+        }
137
+        LuPromise<T> promise = new LuPromise<>();
138
+        StringRequest request = new StringRequest(Request.Method.GET, config.getBaseUrl() + uri.toString(),
139
+                getListener(type, promise), getErrorListener(promise))
140
+        {
141
+            @Override
142
+            public Map<String, String> getHeaders() {
143
+                return config.getHeaders();
144
+            }
145
+        };
146
+        _requestQueue.add(request);
147
+        return promise;
148
+    }
149
+
150
+    public static <T extends LuDbo> LuPromise<T> get(LuDataAccessConfigDbo config, Class<T> type,
151
+                                                     String url)
152
+    {
153
+        return get(config, type, url, new HashMap<String, String>());
154
+    }
155
+
156
+    public static <T extends LuDbo> LuPromise<T> post(LuDataAccessConfigDbo config, Class<T> type,
157
+                                                      String url, final HashMap<String, String> postParams)
158
+    {
159
+        return request(config, Request.Method.POST, type, url, postParams);
160
+    }
161
+
162
+    public static <T extends LuDbo> LuPromise<T> post(LuDataAccessConfigDbo config, Class<T> type,
163
+                                                      String url)
164
+    {
165
+        return post(config, type, url, new HashMap<String, String>());
166
+    }
167
+}

+ 20
- 0
luticateutils/src/main/java/com/luticate/utils/dbo/JSONContainer/LuAbstractJsonContainer.java Ver arquivo

@@ -0,0 +1,20 @@
1
+package com.luticate.utils.dbo.JSONContainer;
2
+
3
+import org.json.JSONArray;
4
+import org.json.JSONException;
5
+import org.json.JSONObject;
6
+
7
+/**
8
+ * Created by robin on 10/21/16.
9
+ */
10
+
11
+public interface LuAbstractJsonContainer {
12
+    int getInt(Object key) throws JSONException;
13
+    String getString(Object key) throws JSONException;
14
+    long getLong(Object key) throws JSONException;
15
+    double getDouble(Object key) throws JSONException;
16
+    boolean getBoolean(Object key) throws JSONException;
17
+    JSONObject getJSONObject(Object key) throws JSONException;
18
+    JSONArray getJSONArray(Object key) throws JSONException;
19
+    boolean isNull(Object key) throws JSONException;
20
+}

+ 58
- 0
luticateutils/src/main/java/com/luticate/utils/dbo/JSONContainer/LuJSONArrayContainer.java Ver arquivo

@@ -0,0 +1,58 @@
1
+package com.luticate.utils.dbo.JSONContainer;
2
+
3
+import org.json.JSONArray;
4
+import org.json.JSONException;
5
+import org.json.JSONObject;
6
+
7
+/**
8
+ * Created by robin on 10/21/16.
9
+ */
10
+
11
+public class LuJSONArrayContainer implements LuAbstractJsonContainer {
12
+    protected JSONArray _jsonArray;
13
+
14
+    public LuJSONArrayContainer(JSONArray jsonArray)
15
+    {
16
+        _jsonArray = jsonArray;
17
+    }
18
+
19
+    @Override
20
+    public int getInt(Object key) throws JSONException {
21
+        return _jsonArray.getInt((int) key);
22
+    }
23
+
24
+    @Override
25
+    public String getString(Object key) throws JSONException {
26
+        return _jsonArray.getString((int) key);
27
+    }
28
+
29
+    @Override
30
+    public long getLong(Object key) throws JSONException {
31
+        return _jsonArray.getLong((int) key);
32
+    }
33
+
34
+    @Override
35
+    public double getDouble(Object key) throws JSONException {
36
+        return _jsonArray.getDouble((int) key);
37
+    }
38
+
39
+    @Override
40
+    public boolean getBoolean(Object key) throws JSONException {
41
+        return _jsonArray.getBoolean((int) key);
42
+    }
43
+
44
+    @Override
45
+    public JSONObject getJSONObject(Object key) throws JSONException {
46
+        return _jsonArray.getJSONObject((int) key);
47
+    }
48
+
49
+    @Override
50
+    public JSONArray getJSONArray(Object key) throws JSONException {
51
+        return _jsonArray.getJSONArray((int) key);
52
+    }
53
+
54
+    @Override
55
+    public boolean isNull(Object key) throws JSONException {
56
+        return _jsonArray.isNull((int) key);
57
+    }
58
+}

+ 59
- 0
luticateutils/src/main/java/com/luticate/utils/dbo/JSONContainer/LuJSONObjectContainer.java Ver arquivo

@@ -0,0 +1,59 @@
1
+package com.luticate.utils.dbo.JSONContainer;
2
+
3
+import org.json.JSONArray;
4
+import org.json.JSONException;
5
+import org.json.JSONObject;
6
+
7
+/**
8
+ * Created by robin on 10/21/16.
9
+ */
10
+
11
+public class LuJSONObjectContainer implements LuAbstractJsonContainer {
12
+
13
+    protected JSONObject _jsonObject;
14
+
15
+    public LuJSONObjectContainer(JSONObject jsonObject)
16
+    {
17
+        _jsonObject = jsonObject;
18
+    }
19
+
20
+    @Override
21
+    public int getInt(Object key) throws JSONException {
22
+        return _jsonObject.getInt((String) key);
23
+    }
24
+
25
+    @Override
26
+    public String getString(Object key) throws JSONException {
27
+        return _jsonObject.getString((String) key);
28
+    }
29
+
30
+    @Override
31
+    public long getLong(Object key) throws JSONException {
32
+        return _jsonObject.getLong((String) key);
33
+    }
34
+
35
+    @Override
36
+    public double getDouble(Object key) throws JSONException {
37
+        return _jsonObject.getDouble((String) key);
38
+    }
39
+
40
+    @Override
41
+    public boolean getBoolean(Object key) throws JSONException {
42
+        return _jsonObject.getBoolean((String) key);
43
+    }
44
+
45
+    @Override
46
+    public JSONObject getJSONObject(Object key) throws JSONException {
47
+        return _jsonObject.getJSONObject((String) key);
48
+    }
49
+
50
+    @Override
51
+    public JSONArray getJSONArray(Object key) throws JSONException {
52
+        return _jsonObject.getJSONArray((String) key);
53
+    }
54
+
55
+    @Override
56
+    public boolean isNull(Object key) throws JSONException {
57
+        return _jsonObject.isNull((String) key);
58
+    }
59
+}

+ 26
- 0
luticateutils/src/main/java/com/luticate/utils/dbo/LuBoolDbo.java Ver arquivo

@@ -0,0 +1,26 @@
1
+package com.luticate.utils.dbo;
2
+
3
+/**
4
+ * Created by robin on 11/27/15.
5
+ */
6
+public class LuBoolDbo extends LuDbo {
7
+
8
+    private Boolean _value;
9
+
10
+    public LuBoolDbo()
11
+    {
12
+    }
13
+
14
+    public LuBoolDbo(Boolean value)
15
+    {
16
+        _value = value;
17
+    }
18
+
19
+    public Boolean getBool() {
20
+        return _value;
21
+    }
22
+
23
+    public void setBool(Boolean value) {
24
+        _value = value;
25
+    }
26
+}

+ 57
- 0
luticateutils/src/main/java/com/luticate/utils/dbo/LuDataAccessConfigDbo.java Ver arquivo

@@ -0,0 +1,57 @@
1
+package com.luticate.utils.dbo;
2
+
3
+import android.util.Base64;
4
+
5
+import org.json.JSONException;
6
+import org.json.JSONObject;
7
+
8
+import java.util.HashMap;
9
+import java.util.Map;
10
+
11
+/**
12
+ *
13
+ * Created by robin on 11/28/15.
14
+ */
15
+public class LuDataAccessConfigDbo extends LuDbo {
16
+
17
+    protected String _baseUrl;
18
+
19
+    protected String _httpUsername;
20
+
21
+    protected String _httpPassword;
22
+
23
+    public String getBaseUrl() {
24
+        return _baseUrl;
25
+    }
26
+
27
+    public void setBaseUrl(String baseUrl) {
28
+        _baseUrl = baseUrl;
29
+    }
30
+
31
+    public String getHttpUsername() {
32
+        return _httpUsername;
33
+    }
34
+
35
+    public void setHttpUsername(String httpUsername) {
36
+        _httpUsername = httpUsername;
37
+    }
38
+
39
+    public String getHttpPassword() {
40
+        return _httpPassword;
41
+    }
42
+
43
+    public void setHttpPassword(String httpPassword) {
44
+        _httpPassword = httpPassword;
45
+    }
46
+
47
+    public Map<String, String> getHeaders()
48
+    {
49
+        Map<String, String> map = new HashMap<>();
50
+        if (_httpUsername != null) {
51
+            map.put("Authorization", "Basic " + Base64.encodeToString(
52
+                    String.format("%s:%s", _httpUsername, _httpPassword).getBytes(), Base64.NO_WRAP));
53
+        }
54
+        return map;
55
+    }
56
+
57
+}

+ 272
- 0
luticateutils/src/main/java/com/luticate/utils/dbo/LuDbo.java Ver arquivo

@@ -0,0 +1,272 @@
1
+package com.luticate.utils.dbo;
2
+
3
+import com.luticate.utils.dbo.JSONContainer.LuAbstractJsonContainer;
4
+import com.luticate.utils.dbo.JSONContainer.LuJSONArrayContainer;
5
+import com.luticate.utils.dbo.JSONContainer.LuJSONObjectContainer;
6
+
7
+import org.joda.time.DateTime;
8
+import org.joda.time.LocalDate;
9
+import org.joda.time.LocalDateTime;
10
+import org.joda.time.format.DateTimeFormat;
11
+import org.json.JSONArray;
12
+import org.json.JSONException;
13
+import org.json.JSONObject;
14
+
15
+import java.lang.reflect.Array;
16
+import java.lang.reflect.Field;
17
+import java.lang.reflect.Modifier;
18
+import java.lang.reflect.ParameterizedType;
19
+import java.util.AbstractMap;
20
+import java.util.HashMap;
21
+import java.util.Iterator;
22
+import java.util.List;
23
+import java.util.Vector;
24
+
25
+/**
26
+ * Created by robin on 11/27/15.
27
+ */
28
+public abstract class LuDbo {
29
+
30
+    public static String DEFAULT_DATE_FORMAT = "yy-MM-dd";
31
+
32
+    public static String DEFAULT_TIME_FORMAT = "HH:mm:ss";
33
+
34
+    public static String DEFAULT_DATE_TIME_FORMAT = DEFAULT_DATE_FORMAT + " " + DEFAULT_TIME_FORMAT;
35
+
36
+    public String getFieldFromJson(String jsonName)
37
+    {
38
+        if (!jsonName.startsWith("_")) {
39
+            return String.format("_%s", jsonName);
40
+        }
41
+        return jsonName;
42
+    }
43
+
44
+    public String getJsonFromField(String fieldName)
45
+    {
46
+        if (fieldName.startsWith("_")) {
47
+            return fieldName.substring(1);
48
+        }
49
+        return fieldName;
50
+    }
51
+
52
+    public Object getObjectFromJson(Class clazz, LuAbstractJsonContainer json, Object key) throws Exception {
53
+        if (json.isNull(key)) {
54
+            return null;
55
+        }
56
+
57
+        if (clazz == Byte.class || clazz == byte.class) {
58
+            return (byte) json.getInt(key);
59
+        }
60
+        if (clazz == Character.class || clazz == char.class) {
61
+            return json.getString(key).charAt(0);
62
+        }
63
+        if (clazz == Short.class || clazz == short.class) {
64
+            return (short) json.getInt(key);
65
+        }
66
+        if (clazz == Integer.class || clazz == int.class) {
67
+            return json.getInt(key);
68
+        }
69
+        if (clazz == Long.class || clazz == long.class) {
70
+            return json.getLong(key);
71
+        }
72
+        if (clazz == Float.class || clazz == float.class) {
73
+            return (float) json.getDouble(key);
74
+        }
75
+        if (clazz == Double.class || clazz == double.class) {
76
+            return json.getDouble(key);
77
+        }
78
+        if (clazz == Boolean.class || clazz == boolean.class) {
79
+            return json.getBoolean(key);
80
+        }
81
+        if (clazz == String.class) {
82
+            return json.getString(key);
83
+        }
84
+        if (clazz == LocalDateTime.class) {
85
+            return LocalDateTime.parse(json.getString(key), DateTimeFormat.forPattern(DEFAULT_DATE_TIME_FORMAT));
86
+        }
87
+        if (clazz == DateTime.class) {
88
+            return DateTime.parse(json.getString(key), DateTimeFormat.forPattern(DEFAULT_DATE_TIME_FORMAT));
89
+        }
90
+        if (LuDbo.class.isAssignableFrom(clazz)) {
91
+            LuDbo dbo = (LuDbo) getInstance(clazz);
92
+            dbo.fromJson(json.getJSONObject(key));
93
+            return dbo;
94
+        }
95
+        return null;
96
+    }
97
+
98
+    public Object getJsonFromObject(Class clazz, Object obj)
99
+    {
100
+        if (obj == null) {
101
+            return null;
102
+        }
103
+        if (clazz == char.class || clazz == Character.class) {
104
+            return obj.toString();
105
+        }
106
+        if (clazz.isPrimitive() || clazz == Byte.class || clazz == Character.class
107
+                || clazz == Short.class || clazz == Integer.class || clazz == Long.class
108
+                || clazz == Float.class || clazz == Double.class || clazz == Boolean.class
109
+                || clazz == String.class) {
110
+            return obj;
111
+        }
112
+        if (clazz == LocalDateTime.class) {
113
+            return ((LocalDateTime)obj).toString(DateTimeFormat.forPattern(DEFAULT_DATE_TIME_FORMAT));
114
+        }
115
+        if (clazz == DateTime.class) {
116
+            return ((DateTime)obj).toString(DateTimeFormat.forPattern(DEFAULT_DATE_TIME_FORMAT));
117
+        }
118
+        if (LuDbo.class.isAssignableFrom(clazz)) {
119
+            return ((LuDbo)obj).toJson();
120
+        }
121
+        if (List.class.isAssignableFrom(clazz)) {
122
+            List objList = (List) obj;
123
+            JSONArray list = new JSONArray();
124
+
125
+            for (Object item : objList) {
126
+                list.put(getJsonFromObject(getClazz(item), item));
127
+            }
128
+
129
+            return list;
130
+        }
131
+        if (AbstractMap.class.isAssignableFrom(clazz)) {
132
+            HashMap objMap = (HashMap) obj;
133
+            JSONObject map = new JSONObject();
134
+
135
+            for (Object k : objMap.keySet()) {
136
+                if (k.getClass() == String.class) {
137
+                    Object item = objMap.get(k);
138
+                    try {
139
+                        map.put((String) k, getJsonFromObject(getClazz(item), item));
140
+                    } catch (JSONException ignored) {
141
+                    }
142
+                }
143
+            }
144
+
145
+            return map;
146
+        }
147
+        if (clazz.isArray()) {
148
+            JSONArray list = new JSONArray();
149
+
150
+            for (int i = 0; i < Array.getLength(obj); ++i) {
151
+                Object item = Array.get(obj, i);
152
+                list.put(getJsonFromObject(item == null ? null : item.getClass(), item));
153
+            }
154
+
155
+            return list;
156
+        }
157
+        return null;
158
+    }
159
+
160
+    public Object getInstance(Class clazz) throws Exception {
161
+        if (clazz == List.class) {
162
+            return new Vector<>();
163
+        }
164
+        if (clazz == AbstractMap.class) {
165
+            return new HashMap<>();
166
+        }
167
+        return clazz.newInstance();
168
+    }
169
+
170
+    public Class getClazz(Object obj)
171
+    {
172
+        return obj == null ? null : obj.getClass();
173
+    }
174
+
175
+    public void fromJson(String data) throws Exception
176
+    {
177
+        JSONObject json = new JSONObject(data);
178
+        fromJson(json);
179
+    }
180
+
181
+    public void fromJson(JSONObject json) throws Exception
182
+    {
183
+        for (Field field : getClass().getDeclaredFields()) {
184
+            if (Modifier.isTransient(field.getModifiers())) {
185
+                continue;
186
+            }
187
+            String key = getJsonFromField(field.getName());
188
+            Class clazz = field.getType();
189
+            if (json.has(key)) {
190
+                Object value = null;
191
+
192
+                if (List.class.isAssignableFrom(clazz)) {
193
+                    ParameterizedType parameterizedType = (ParameterizedType) field.getGenericType();
194
+                    Class type = (Class) parameterizedType.getActualTypeArguments()[0];
195
+                    List<Object> list = (List<Object>) getInstance(clazz);
196
+                    JSONArray jsonArray = json.getJSONArray(key);
197
+                    for (int i = 0; i < jsonArray.length(); ++i) {
198
+                        list.add(getObjectFromJson(type, new LuJSONArrayContainer(jsonArray), i));
199
+                    }
200
+                    value = list;
201
+                }
202
+                else if (clazz.isArray()) {
203
+                    Class type = clazz.getComponentType();
204
+                    JSONArray jsonArray = json.getJSONArray(key);
205
+                    Object array = Array.newInstance(type, jsonArray.length());
206
+                    for (int i = 0; i < jsonArray.length(); ++i) {
207
+                        Array.set(array, i, getObjectFromJson(type, new LuJSONArrayContainer(jsonArray), i));
208
+                    }
209
+                    value = array;
210
+                }
211
+                else if (AbstractMap.class.isAssignableFrom(clazz)) {
212
+                    ParameterizedType parameterizedType = (ParameterizedType) field.getGenericType();
213
+                    Class type = (Class) parameterizedType.getActualTypeArguments()[0];
214
+                    if (type == String.class) {
215
+                        type = (Class) parameterizedType.getActualTypeArguments()[1];
216
+                        AbstractMap<String, Object> map = (AbstractMap<String, Object>) getInstance(clazz);
217
+                        JSONObject obj = json.getJSONObject(key);
218
+                        Iterator<String> it = obj.keys();
219
+                        while (it.hasNext()) {
220
+                            String k = it.next();
221
+                            map.put(k, getObjectFromJson(type, new LuJSONObjectContainer(obj), k));
222
+                        }
223
+                        value = map;
224
+                    }
225
+                }
226
+                else {
227
+                    value = getObjectFromJson(clazz, new LuJSONObjectContainer(json), key);
228
+                }
229
+                field.setAccessible(true);
230
+                field.set(this, value);
231
+                field.setAccessible(false);
232
+            }
233
+        }
234
+    }
235
+
236
+    public HashMap<String, Object> toArray()
237
+    {
238
+        HashMap<String, Object> map = new HashMap<>();
239
+
240
+        for (Field field : getClass().getDeclaredFields()) {
241
+            if (Modifier.isTransient(field.getModifiers())) {
242
+                continue;
243
+            }
244
+            String key = getJsonFromField(field.getName());
245
+            Class clazz = field.getType();
246
+            field.setAccessible(true);
247
+            Object obj = null;
248
+            try {
249
+                obj = field.get(this);
250
+            } catch (IllegalAccessException ignored) {
251
+            }
252
+            field.setAccessible(false);
253
+            map.put(key, getJsonFromObject(clazz, obj));
254
+        }
255
+
256
+        return map;
257
+    }
258
+
259
+    public JSONObject toJson()
260
+    {
261
+        HashMap<String, Object> array = toArray();
262
+        JSONObject json = new JSONObject(array);
263
+        return json;
264
+    }
265
+
266
+    @Override
267
+    public String toString()
268
+    {
269
+        return toJson().toString();
270
+    }
271
+
272
+}

+ 27
- 0
luticateutils/src/main/java/com/luticate/utils/dbo/LuDoubleDbo.java Ver arquivo

@@ -0,0 +1,27 @@
1
+package com.luticate.utils.dbo;
2
+
3
+/**
4
+ * Created by robin on 10/22/16.
5
+ */
6
+
7
+public class LuDoubleDbo extends LuDbo {
8
+
9
+    protected Double _value;
10
+
11
+    public LuDoubleDbo()
12
+    {
13
+    }
14
+
15
+    public LuDoubleDbo(Double value)
16
+    {
17
+        _value = value;
18
+    }
19
+
20
+    public Double getDouble() {
21
+        return _value;
22
+    }
23
+
24
+    public void setDouble(Double aDouble) {
25
+        _value = aDouble;
26
+    }
27
+}

+ 27
- 0
luticateutils/src/main/java/com/luticate/utils/dbo/LuIntDbo.java Ver arquivo

@@ -0,0 +1,27 @@
1
+package com.luticate.utils.dbo;
2
+
3
+/**
4
+ * Created by robin on 11/27/15.
5
+ */
6
+public class LuIntDbo extends LuDbo {
7
+
8
+    private Integer _value;
9
+
10
+    public LuIntDbo()
11
+    {
12
+    }
13
+
14
+    public LuIntDbo(Integer value)
15
+    {
16
+        _value = value;
17
+    }
18
+
19
+    public Integer getInt() {
20
+        return _value;
21
+    }
22
+
23
+    public void setInt(Integer value) {
24
+        _value = value;
25
+    }
26
+
27
+}

+ 27
- 0
luticateutils/src/main/java/com/luticate/utils/dbo/LuLongDbo.java Ver arquivo

@@ -0,0 +1,27 @@
1
+package com.luticate.utils.dbo;
2
+
3
+/**
4
+ * Created by robin on 10/22/16.
5
+ */
6
+
7
+public class LuLongDbo extends LuDbo {
8
+
9
+    protected Long _value;
10
+
11
+    public LuLongDbo()
12
+    {
13
+    }
14
+
15
+    public LuLongDbo(Long value)
16
+    {
17
+        _value = value;
18
+    }
19
+
20
+    public Long getLong() {
21
+        return _value;
22
+    }
23
+
24
+    public void setLong(Long aLong) {
25
+        _value = aLong;
26
+    }
27
+}

+ 66
- 0
luticateutils/src/main/java/com/luticate/utils/dbo/LuPaginatedDbo.java Ver arquivo

@@ -0,0 +1,66 @@
1
+package com.luticate.utils.dbo;
2
+
3
+import org.json.JSONArray;
4
+import org.json.JSONObject;
5
+
6
+import java.util.HashMap;
7
+import java.util.List;
8
+import java.util.Vector;
9
+
10
+/**
11
+ *
12
+ * Created by robin on 11/27/15.
13
+ */
14
+public class LuPaginatedDbo<T extends LuDbo> extends LuDbo {
15
+
16
+    private transient Class<T> _clazz;
17
+
18
+    private List<T> _data = new Vector<>();
19
+
20
+    private int _count;
21
+
22
+    public LuPaginatedDbo(Class<T> clazz)
23
+    {
24
+        _clazz = clazz;
25
+    }
26
+
27
+    public List<T> getData() {
28
+        return _data;
29
+    }
30
+
31
+    public void setData(List<T> data) {
32
+        _data = data;
33
+    }
34
+
35
+    public int getCount() {
36
+        return _count;
37
+    }
38
+
39
+    public void setCount(int count) {
40
+        _count = count;
41
+    }
42
+
43
+    @Override
44
+    public void fromJson(JSONObject json) throws Exception {
45
+        _count = json.getInt("count");
46
+        JSONArray array = json.getJSONArray("data");
47
+
48
+        for (int i = 0; i < array.length(); ++i) {
49
+            T dbo = _clazz.newInstance();
50
+            dbo.fromJson(array.getJSONObject(i));
51
+            _data.add(dbo);
52
+        }
53
+    }
54
+
55
+    @Override
56
+    public HashMap<String, Object> toArray() {
57
+        HashMap<String, Object> array = new HashMap<>();
58
+        array.put("count", _count);
59
+        Vector<HashMap<String, Object>> data = new Vector<>();
60
+        for (T value : _data) {
61
+            data.add(value.toArray());
62
+        }
63
+        array.put("data", data);
64
+        return array;
65
+    }
66
+}

+ 44
- 0
luticateutils/src/main/java/com/luticate/utils/dbo/LuPromiseError.java Ver arquivo

@@ -0,0 +1,44 @@
1
+package com.luticate.utils.dbo;
2
+
3
+/**
4
+ * Created by robin on 10/22/16.
5
+ */
6
+
7
+public class LuPromiseError {
8
+
9
+    private String _error;
10
+
11
+    private int _statusCode;
12
+
13
+    public LuPromiseError()
14
+    {
15
+    }
16
+
17
+    public LuPromiseError(String error, int statusCode)
18
+    {
19
+        _error = error;
20
+        _statusCode = statusCode;
21
+    }
22
+
23
+    public String getError() {
24
+        return _error;
25
+    }
26
+
27
+    public void setError(String error) {
28
+        _error = error;
29
+    }
30
+
31
+    public int getStatusCode() {
32
+        return _statusCode;
33
+    }
34
+
35
+    public void setStatusCode(int statusCode) {
36
+        _statusCode = statusCode;
37
+    }
38
+
39
+    @Override
40
+    public String toString() {
41
+        return _error + " (Status code : " + _statusCode + ")";
42
+    }
43
+
44
+}

+ 27
- 0
luticateutils/src/main/java/com/luticate/utils/dbo/LuStringDbo.java Ver arquivo

@@ -0,0 +1,27 @@
1
+package com.luticate.utils.dbo;
2
+
3
+/**
4
+ * Created by robin on 11/27/15.
5
+ */
6
+public class LuStringDbo extends LuDbo {
7
+
8
+    private String _value;
9
+
10
+    public LuStringDbo()
11
+    {
12
+    }
13
+
14
+    public LuStringDbo(String value)
15
+    {
16
+        _value = value;
17
+    }
18
+
19
+    public String getString() {
20
+        return _value;
21
+    }
22
+
23
+    public void setString(String value) {
24
+        _value = value;
25
+    }
26
+
27
+}

+ 7
- 0
luticateutils/src/main/java/com/luticate/utils/dbo/LuVoidDbo.java Ver arquivo

@@ -0,0 +1,7 @@
1
+package com.luticate.utils.dbo;
2
+
3
+/**
4
+ * Created by robin on 11/27/15.
5
+ */
6
+public class LuVoidDbo extends LuDbo {
7
+}

+ 222
- 0
luticateutils/src/test/java/com/luticate/utils/BasicDboTest.java Ver arquivo

@@ -0,0 +1,222 @@
1
+package com.luticate.utils;
2
+
3
+import com.luticate.utils.dbo.LuBoolDbo;
4
+import com.luticate.utils.dbo.LuDataAccessConfigDbo;
5
+import com.luticate.utils.dbo.LuDoubleDbo;
6
+import com.luticate.utils.dbo.LuIntDbo;
7
+import com.luticate.utils.dbo.LuLongDbo;
8
+import com.luticate.utils.dbo.LuPaginatedDbo;
9
+import com.luticate.utils.dbo.LuStringDbo;
10
+import com.luticate.utils.dbo.LuVoidDbo;
11
+
12
+import org.junit.Test;
13
+
14
+import java.util.HashMap;
15
+import java.util.List;
16
+import java.util.Map;
17
+import java.util.Vector;
18
+
19
+import static org.junit.Assert.*;
20
+
21
+/**
22
+ * Created by robin on 10/22/16.
23
+ */
24
+
25
+public class BasicDboTest {
26
+
27
+    @Test
28
+    public void boolTest() throws Exception {
29
+        LuBoolDbo dbo = new LuBoolDbo();
30
+        dbo.fromJson("{\"value\": true}");
31
+        assertTrue(dbo.getBool());
32
+
33
+        dbo = new LuBoolDbo();
34
+        dbo.fromJson("{\"value\": null}");
35
+        assertNull(dbo.getBool());
36
+
37
+        dbo = new LuBoolDbo();
38
+        dbo.fromJson("{\"value\": false}");
39
+        assertFalse(dbo.getBool());
40
+        dbo.setBool(true);
41
+
42
+        LuBoolDbo dbo2 = new LuBoolDbo();
43
+        dbo2.fromJson(dbo.toString());
44
+        assertTrue(dbo2.getBool());
45
+
46
+        dbo = new LuBoolDbo(false);
47
+        assertFalse(dbo.getBool());
48
+
49
+        dbo = new LuBoolDbo(true);
50
+        assertTrue(dbo.getBool());
51
+    }
52
+
53
+    @Test
54
+    public void intTest() throws Exception {
55
+        LuIntDbo dbo = new LuIntDbo();
56
+        dbo.fromJson("{\"value\": 42}");
57
+        assertEquals(42, dbo.getInt().intValue());
58
+
59
+        dbo = new LuIntDbo();
60
+        dbo.fromJson("{\"value\": null}");
61
+        assertNull(dbo.getInt());
62
+
63
+        dbo = new LuIntDbo();
64
+        dbo.fromJson("{\"value\": 24}");
65
+        assertEquals(24, dbo.getInt().intValue());
66
+        dbo.setInt(4242);
67
+
68
+        LuIntDbo dbo2 = new LuIntDbo();
69
+        dbo2.fromJson(dbo.toString());
70
+        assertEquals(4242, dbo2.getInt().intValue());
71
+
72
+        dbo = new LuIntDbo(42);
73
+        assertEquals(42, dbo.getInt().intValue());
74
+
75
+        dbo = new LuIntDbo(24);
76
+        assertEquals(24, dbo.getInt().intValue());
77
+    }
78
+
79
+    @Test
80
+    public void longTest() throws Exception {
81
+        LuLongDbo dbo = new LuLongDbo();
82
+        dbo.fromJson("{\"value\": 42}");
83
+        assertEquals(42, dbo.getLong().longValue());
84
+
85
+        dbo = new LuLongDbo();
86
+        dbo.fromJson("{\"value\": null}");
87
+        assertNull(dbo.getLong());
88
+
89
+        dbo = new LuLongDbo();
90
+        dbo.fromJson("{\"value\": 24}");
91
+        assertEquals(24, dbo.getLong().longValue());
92
+        dbo.setLong((long) 4242);
93
+
94
+        LuLongDbo dbo2 = new LuLongDbo();
95
+        dbo2.fromJson(dbo.toString());
96
+        assertEquals(4242, dbo2.getLong().longValue());
97
+
98
+        dbo = new LuLongDbo((long) 42);
99
+        assertEquals(42, dbo.getLong().longValue());
100
+
101
+        dbo = new LuLongDbo((long) 24);
102
+        assertEquals(24, dbo.getLong().longValue());
103
+    }
104
+
105
+    @Test
106
+    public void doubleTest() throws Exception {
107
+        LuDoubleDbo dbo = new LuDoubleDbo();
108
+        dbo.fromJson("{\"value\": 42.125}");
109
+        assertEquals(42.125, dbo.getDouble(), 0);
110
+
111
+        dbo = new LuDoubleDbo();
112
+        dbo.fromJson("{\"value\": null}");
113
+        assertNull(dbo.getDouble());
114
+
115
+        dbo = new LuDoubleDbo();
116
+        dbo.fromJson("{\"value\": 24.125}");
117
+        assertEquals(24.125, dbo.getDouble(), 0);
118
+        dbo.setDouble(4242.125);
119
+
120
+        LuDoubleDbo dbo2 = new LuDoubleDbo();
121
+        dbo2.fromJson(dbo.toString());
122
+        assertEquals(4242.125, dbo2.getDouble(), 0);
123
+
124
+        dbo = new LuDoubleDbo(42.125);
125
+        assertEquals(42.125, dbo.getDouble(), 0);
126
+
127
+        dbo = new LuDoubleDbo(24.125);
128
+        assertEquals(24.125, dbo.getDouble(), 0);
129
+    }
130
+
131
+    @Test
132
+    public void stringTest() throws Exception {
133
+        LuStringDbo dbo = new LuStringDbo();
134
+        dbo.fromJson("{\"value\": \"42\"}");
135
+        assertEquals("42", dbo.getString());
136
+
137
+        dbo = new LuStringDbo();
138
+        dbo.fromJson("{\"value\": null}");
139
+        assertNull(dbo.getString());
140
+
141
+        dbo = new LuStringDbo();
142
+        dbo.fromJson("{\"value\": \"24\"}");
143
+        assertEquals("24", dbo.getString());
144
+        dbo.setString("4242");
145
+
146
+        LuStringDbo dbo2 = new LuStringDbo();
147
+        dbo2.fromJson(dbo.toString());
148
+        assertEquals("4242", dbo2.getString());
149
+
150
+        dbo = new LuStringDbo("42 42");
151
+        assertEquals("42 42", dbo.getString());
152
+
153
+        dbo = new LuStringDbo("24 24");
154
+        assertEquals("24 24", dbo.getString());
155
+    }
156
+
157
+    @Test
158
+    public void paginatedTest() throws Exception {
159
+        LuPaginatedDbo<LuIntDbo> dbo = new LuPaginatedDbo<>(LuIntDbo.class);
160
+        dbo.fromJson("{\"count\": 42, \"data\": [{\"value\": 1}, {\"value\": 2}, {\"value\": 3}]}");
161
+        assertEquals(42, dbo.getCount());
162
+        assertNotNull(dbo.getData());
163
+        assertEquals(3, dbo.getData().size());
164
+        assertEquals(1, dbo.getData().get(0).getInt().intValue());
165
+        assertEquals(2, dbo.getData().get(1).getInt().intValue());
166
+        assertEquals(3, dbo.getData().get(2).getInt().intValue());
167
+
168
+        dbo.setCount(24);
169
+        List<LuIntDbo> list = new Vector<>();
170
+        list.add(new LuIntDbo(10));
171
+        list.add(new LuIntDbo(20));
172
+        dbo.setData(list);;
173
+        assertEquals(24, dbo.getCount());
174
+        assertNotNull(dbo.getData());
175
+        assertEquals(2, dbo.getData().size());
176
+        assertEquals(10, dbo.getData().get(0).getInt().intValue());
177
+        assertEquals(20, dbo.getData().get(1).getInt().intValue());
178
+
179
+        HashMap<String, Object> array = dbo.toArray();
180
+        assertEquals(2, array.size());
181
+        assertTrue(array.containsKey("count"));
182
+        assertEquals(24, array.get("count"));
183
+        assertTrue(array.containsKey("data"));
184
+        assertEquals(2, ((List)array.get("data")).size());
185
+    }
186
+
187
+    @Test
188
+    public void dataAccessConfigTest() throws Exception {
189
+        LuDataAccessConfigDbo dbo = new LuDataAccessConfigDbo();
190
+        dbo.fromJson("{\"baseUrl\": \"http://api/\", \"httpUsername\": \"root\", \"httpPassword\": \"toor42\"}");
191
+        assertEquals("http://api/", dbo.getBaseUrl());
192
+        assertEquals("root", dbo.getHttpUsername());
193
+        assertEquals("toor42", dbo.getHttpPassword());
194
+        Map<String, String> headers = dbo.getHeaders();
195
+        assertEquals(1, headers.size());
196
+        assertTrue(headers.containsKey("Authorization"));
197
+        assertEquals("Basic cm9vdDp0b29yNDI=", headers.get("Authorization"));
198
+
199
+        dbo = new LuDataAccessConfigDbo();
200
+        dbo.fromJson("{\"baseUrl\": \"http://api2/\"}");
201
+        assertEquals("http://api2/", dbo.getBaseUrl());
202
+        assertNull(dbo.getHttpUsername());
203
+        assertNull(dbo.getHttpPassword());
204
+        headers = dbo.getHeaders();
205
+        assertEquals(0, headers.size());
206
+        dbo.setBaseUrl("http://api/");
207
+        dbo.setHttpUsername("root");
208
+        dbo.setHttpPassword("toor42");
209
+        assertEquals("http://api/", dbo.getBaseUrl());
210
+        assertEquals("root", dbo.getHttpUsername());
211
+        assertEquals("toor42", dbo.getHttpPassword());
212
+
213
+        HashMap<String, Object> array = dbo.toArray();
214
+        assertEquals(3, array.size());
215
+        assertTrue(array.containsKey("baseUrl"));
216
+        assertEquals("http://api/", array.get("baseUrl"));
217
+        assertTrue(array.containsKey("httpUsername"));
218
+        assertEquals("root", array.get("httpUsername"));
219
+        assertTrue(array.containsKey("httpPassword"));
220
+        assertEquals("toor42", array.get("httpPassword"));
221
+    }
222
+}

+ 35
- 0
luticateutils/src/test/java/com/luticate/utils/NameDboTest.java Ver arquivo

@@ -0,0 +1,35 @@
1
+package com.luticate.utils;
2
+
3
+import com.luticate.utils.dbo.LuDbo;
4
+import com.luticate.utils.dbo.LuVoidDbo;
5
+
6
+import org.junit.Test;
7
+
8
+import static org.junit.Assert.*;
9
+
10
+/**
11
+ * Created by robin on 10/20/16.
12
+ */
13
+
14
+public class NameDboTest {
15
+
16
+    @Test
17
+    public void jsonFromFieldTest()
18
+    {
19
+        LuDbo dbo = new LuVoidDbo();
20
+        assertEquals("byte", dbo.getJsonFromField("_byte"));
21
+        assertEquals("anotherVariable", dbo.getJsonFromField("_anotherVariable"));
22
+        assertEquals("byte", dbo.getJsonFromField("byte"));
23
+        assertEquals("anotherVariable", dbo.getJsonFromField("anotherVariable"));
24
+    }
25
+
26
+    @Test
27
+    public void fieldFromJsonTest()
28
+    {
29
+        LuDbo dbo = new LuVoidDbo();
30
+        assertEquals("_byte", dbo.getFieldFromJson("byte"));
31
+        assertEquals("_anotherVariable", dbo.getFieldFromJson("anotherVariable"));
32
+        assertEquals("_byte", dbo.getFieldFromJson("_byte"));
33
+        assertEquals("_anotherVariable", dbo.getFieldFromJson("_anotherVariable"));
34
+    }
35
+}

+ 181
- 0
luticateutils/src/test/java/com/luticate/utils/PromiseTest.java Ver arquivo

@@ -0,0 +1,181 @@
1
+package com.luticate.utils;
2
+
3
+import com.luticate.utils.business.LuConsumer;
4
+import com.luticate.utils.business.LuConverter;
5
+import com.luticate.utils.business.LuPromise;
6
+import com.luticate.utils.dbo.LuPromiseError;
7
+import com.luticate.utils.dbo.LuVoidDbo;
8
+
9
+import org.junit.Test;
10
+
11
+import static org.junit.Assert.*;
12
+
13
+/**
14
+ * Created by robin on 10/22/16.
15
+ */
16
+
17
+public class PromiseTest {
18
+
19
+    @Test
20
+    public void resolveTest()
21
+    {
22
+        LuPromise<Integer> promise = new LuPromise<>();
23
+        final int[] results = new int[]{42, 24, 4242};
24
+
25
+        promise.then(new LuConsumer<Integer>() {
26
+            @Override
27
+            public void execute(Integer data) {
28
+                assertEquals(42, results[0]);
29
+                assertEquals(24, results[1]);
30
+                assertEquals(4242, results[2]);
31
+                ++results[0];
32
+            }
33
+        }, new LuConsumer<LuPromiseError>() {
34
+            @Override
35
+            public void execute(LuPromiseError data) {
36
+                assertEquals(42, results[0]);
37
+                assertEquals(24, results[1]);
38
+                assertEquals(4242, results[2]);
39
+                --results[0];
40
+            }
41
+        }).then(new LuConsumer<Integer>() {
42
+            @Override
43
+            public void execute(Integer data) {
44
+                assertEquals(43, results[0]);
45
+                assertEquals(24, results[1]);
46
+                assertEquals(4242, results[2]);
47
+                ++results[1];
48
+            }
49
+        }, new LuConsumer<LuPromiseError>() {
50
+            @Override
51
+            public void execute(LuPromiseError data) {
52
+                assertEquals(41, results[0]);
53
+                assertEquals(24, results[1]);
54
+                assertEquals(4242, results[2]);
55
+                --results[1];
56
+            }
57
+        });
58
+        assertEquals(42, results[0]);
59
+        assertEquals(24, results[1]);
60
+        assertEquals(4242, results[2]);
61
+        assertEquals(LuPromise.LuPromiseStatus.Running, promise.getStatus());
62
+        assertNull(promise.getData());
63
+
64
+        promise.resolve(4224).then(new LuConsumer<Integer>() {
65
+            @Override
66
+            public void execute(Integer data) {
67
+                assertEquals(43, results[0]);
68
+                assertEquals(25, results[1]);
69
+                assertEquals(4242, results[2]);
70
+                ++results[2];
71
+            }
72
+        }, new LuConsumer<LuPromiseError>() {
73
+            @Override
74
+            public void execute(LuPromiseError data) {
75
+                assertEquals(41, results[0]);
76
+                assertEquals(23, results[1]);
77
+                assertEquals(4242, results[2]);
78
+                --results[2];
79
+            }
80
+        });
81
+        assertEquals(43, results[0]);
82
+        assertEquals(25, results[1]);
83
+        assertEquals(4243, results[2]);
84
+        assertEquals(LuPromise.LuPromiseStatus.Resolved, promise.getStatus());
85
+        assertEquals(4224, promise.getData().intValue());
86
+    }
87
+
88
+    @Test
89
+    public void rejectTest()
90
+    {
91
+        LuPromise<Integer> promise = new LuPromise<>();
92
+        final int[] results = new int[]{42, 24, 4242};
93
+
94
+        promise.then(new LuConsumer<Integer>() {
95
+            @Override
96
+            public void execute(Integer data) {
97
+                assertEquals(42, results[0]);
98
+                assertEquals(24, results[1]);
99
+                assertEquals(4242, results[2]);
100
+                ++results[0];
101
+            }
102
+        }, new LuConsumer<LuPromiseError>() {
103
+            @Override
104
+            public void execute(LuPromiseError data) {
105
+                assertEquals(42, results[0]);
106
+                assertEquals(24, results[1]);
107
+                assertEquals(4242, results[2]);
108
+                --results[0];
109
+            }
110
+        }).then(new LuConsumer<Integer>() {
111
+            @Override
112
+            public void execute(Integer data) {
113
+                assertEquals(43, results[0]);
114
+                assertEquals(24, results[1]);
115
+                assertEquals(4242, results[2]);
116
+                ++results[1];
117
+            }
118
+        }, new LuConsumer<LuPromiseError>() {
119
+            @Override
120
+            public void execute(LuPromiseError data) {
121
+                assertEquals(41, results[0]);
122
+                assertEquals(24, results[1]);
123
+                assertEquals(4242, results[2]);
124
+                --results[1];
125
+            }
126
+        });
127
+        assertEquals(42, results[0]);
128
+        assertEquals(24, results[1]);
129
+        assertEquals(4242, results[2]);
130
+        assertEquals(LuPromise.LuPromiseStatus.Running, promise.getStatus());
131
+        assertNull(promise.getData());
132
+
133
+        promise.reject(null).then(new LuConsumer<Integer>() {
134
+            @Override
135
+            public void execute(Integer data) {
136
+                assertEquals(43, results[0]);
137
+                assertEquals(25, results[1]);
138
+                assertEquals(4242, results[2]);
139
+                ++results[2];
140
+            }
141
+        }, new LuConsumer<LuPromiseError>() {
142
+            @Override
143
+            public void execute(LuPromiseError data) {
144
+                assertEquals(41, results[0]);
145
+                assertEquals(23, results[1]);
146
+                assertEquals(4242, results[2]);
147
+                --results[2];
148
+            }
149
+        });
150
+        assertEquals(41, results[0]);
151
+        assertEquals(23, results[1]);
152
+        assertEquals(4241, results[2]);
153
+        assertEquals(LuPromise.LuPromiseStatus.Failed, promise.getStatus());
154
+        assertNull(promise.getData());
155
+    }
156
+
157
+    @Test
158
+    public void mapTest()
159
+    {
160
+        LuPromise<Integer> promise = new LuPromise<>();
161
+        final int[] result = new int[1];
162
+        promise.map(new LuConverter<Integer, Boolean>() {
163
+            @Override
164
+            public Boolean convert(Integer data) {
165
+                return data == 42;
166
+            }
167
+        }).then(new LuConsumer<Boolean>() {
168
+            @Override
169
+            public void execute(Boolean data) {
170
+                result[0] = data ? 4242 : 2424;
171
+            }
172
+        }, new LuConsumer<LuPromiseError>() {
173
+            @Override
174
+            public void execute(LuPromiseError data) {
175
+                result[0] = 2442;
176
+            }
177
+        });
178
+        promise.resolve(42);
179
+        assertEquals(result[0], 4242);
180
+    }
181
+}

+ 49
- 0
luticateutils/src/test/java/com/luticate/utils/Test2Dbo.java Ver arquivo

@@ -0,0 +1,49 @@
1
+package com.luticate.utils;
2
+
3
+import com.luticate.utils.dbo.LuDbo;
4
+
5
+/**
6
+ * Created by robin on 10/20/16.
7
+ */
8
+
9
+public class Test2Dbo extends LuDbo {
10
+
11
+    protected String _aString;
12
+
13
+    protected int _aInt;
14
+
15
+    public String getaString() {
16
+        return _aString;
17
+    }
18
+
19
+    public void setaString(String aString) {
20
+        _aString = aString;
21
+    }
22
+
23
+    public int getaInt() {
24
+        return _aInt;
25
+    }
26
+
27
+    public void setaInt(int aInt) {
28
+        _aInt = aInt;
29
+    }
30
+
31
+    @Override
32
+    public boolean equals(Object o) {
33
+        if (this == o) return true;
34
+        if (o == null || getClass() != o.getClass()) return false;
35
+
36
+        Test2Dbo test2Dbo = (Test2Dbo) o;
37
+
38
+        if (_aInt != test2Dbo._aInt) return false;
39
+        return _aString != null ? _aString.equals(test2Dbo._aString) : test2Dbo._aString == null;
40
+
41
+    }
42
+
43
+    @Override
44
+    public int hashCode() {
45
+        int result = _aString != null ? _aString.hashCode() : 0;
46
+        result = 31 * result + _aInt;
47
+        return result;
48
+    }
49
+}

+ 365
- 0
luticateutils/src/test/java/com/luticate/utils/TestDbo.java Ver arquivo

@@ -0,0 +1,365 @@
1
+package com.luticate.utils;
2
+
3
+import com.luticate.utils.dbo.LuDbo;
4
+
5
+import java.io.Serializable;
6
+import java.util.AbstractMap;
7
+import java.util.Arrays;
8
+import java.util.HashMap;
9
+import java.util.List;
10
+
11
+/**
12
+ * Created by robin on 10/20/16.
13
+ */
14
+
15
+public class TestDbo extends LuDbo implements Serializable {
16
+    protected byte _byte;
17
+    protected char _char;
18
+    protected short _short;
19
+    protected int _int;
20
+    protected long _long;
21
+    protected float _float;
22
+    protected double _double;
23
+    protected boolean _boolean;
24
+
25
+    protected Byte _byteObject;
26
+    protected Character _charObject;
27
+    protected Short _shortObject;
28
+    protected Integer _intObject;
29
+    protected Long _longObject;
30
+    protected Float _floatObject;
31
+    protected Double _doubleObject;
32
+    protected Boolean _booleanObject;
33
+
34
+    protected String _string;
35
+
36
+    protected Test2Dbo _test2Dbo;
37
+    protected Test2Dbo _test2Dbo2;
38
+
39
+    protected List<Integer> _integers;
40
+    protected int[] _ints;
41
+
42
+    protected List<Test2Dbo> _test2Dbos;
43
+    protected Test2Dbo[] _dbos;
44
+
45
+    protected HashMap<String, Integer> _hashMap;
46
+    protected AbstractMap<String, Test2Dbo> _hashMap2;
47
+
48
+    protected String _aNullString;
49
+    protected Class _object = TestDbo.class;
50
+
51
+    protected transient String _transientField;
52
+
53
+    public byte getByte() {
54
+        return _byte;
55
+    }
56
+
57
+    public void setByte(byte aByte) {
58
+        _byte = aByte;
59
+    }
60
+
61
+    public char getChar() {
62
+        return _char;
63
+    }
64
+
65
+    public void setChar(char aChar) {
66
+        _char = aChar;
67
+    }
68
+
69
+    public short getShort() {
70
+        return _short;
71
+    }
72
+
73
+    public void setShort(short aShort) {
74
+        _short = aShort;
75
+    }
76
+
77
+    public int getInt() {
78
+        return _int;
79
+    }
80
+
81
+    public void setInt(int anInt) {
82
+        _int = anInt;
83
+    }
84
+
85
+    public long getLong() {
86
+        return _long;
87
+    }
88
+
89
+    public void setLong(long aLong) {
90
+        _long = aLong;
91
+    }
92
+
93
+    public float getFloat() {
94
+        return _float;
95
+    }
96
+
97
+    public void setFloat(float aFloat) {
98
+        _float = aFloat;
99
+    }
100
+
101
+    public double getDouble() {
102
+        return _double;
103
+    }
104
+
105
+    public void setDouble(double aDouble) {
106
+        _double = aDouble;
107
+    }
108
+
109
+    public boolean isBoolean() {
110
+        return _boolean;
111
+    }
112
+
113
+    public void setBoolean(boolean aBoolean) {
114
+        _boolean = aBoolean;
115
+    }
116
+
117
+    public Byte getByteObject() {
118
+        return _byteObject;
119
+    }
120
+
121
+    public void setByteObject(Byte byteObject) {
122
+        _byteObject = byteObject;
123
+    }
124
+
125
+    public Character getCharObject() {
126
+        return _charObject;
127
+    }
128
+
129
+    public void setCharObject(Character charObject) {
130
+        _charObject = charObject;
131
+    }
132
+
133
+    public Short getShortObject() {
134
+        return _shortObject;
135
+    }
136
+
137
+    public void setShortObject(Short shortObject) {
138
+        _shortObject = shortObject;
139
+    }
140
+
141
+    public Integer getIntObject() {
142
+        return _intObject;
143
+    }
144
+
145
+    public void setIntObject(Integer intObject) {
146
+        _intObject = intObject;
147
+    }
148
+
149
+    public Long getLongObject() {
150
+        return _longObject;
151
+    }
152
+
153
+    public void setLongObject(Long longObject) {
154
+        _longObject = longObject;
155
+    }
156
+
157
+    public Float getFloatObject() {
158
+        return _floatObject;
159
+    }
160
+
161
+    public void setFloatObject(Float floatObject) {
162
+        _floatObject = floatObject;
163
+    }
164
+
165
+    public Double getDoubleObject() {
166
+        return _doubleObject;
167
+    }
168
+
169
+    public void setDoubleObject(Double doubleObject) {
170
+        _doubleObject = doubleObject;
171
+    }
172
+
173
+    public Boolean getBooleanObject() {
174
+        return _booleanObject;
175
+    }
176
+
177
+    public void setBooleanObject(Boolean booleanObject) {
178
+        _booleanObject = booleanObject;
179
+    }
180
+
181
+    public String getString() {
182
+        return _string;
183
+    }
184
+
185
+    public void setString(String string) {
186
+        _string = string;
187
+    }
188
+
189
+    public Test2Dbo getTest2Dbo() {
190
+        return _test2Dbo;
191
+    }
192
+
193
+    public void setTest2Dbo(Test2Dbo test2Dbo) {
194
+        _test2Dbo = test2Dbo;
195
+    }
196
+
197
+    public Test2Dbo getTest2Dbo2() {
198
+        return _test2Dbo2;
199
+    }
200
+
201
+    public void setTest2Dbo2(Test2Dbo test2Dbo2) {
202
+        _test2Dbo2 = test2Dbo2;
203
+    }
204
+
205
+    public List<Integer> getIntegers() {
206
+        return _integers;
207
+    }
208
+
209
+    public void setIntegers(List<Integer> integers) {
210
+        _integers = integers;
211
+    }
212
+
213
+    public int[] getInts() {
214
+        return _ints;
215
+    }
216
+
217
+    public void setInts(int[] ints) {
218
+        _ints = ints;
219
+    }
220
+
221
+    public List<Test2Dbo> getTest2Dbos() {
222
+        return _test2Dbos;
223
+    }
224
+
225
+    public void setTest2Dbos(List<Test2Dbo> test2Dbos) {
226
+        _test2Dbos = test2Dbos;
227
+    }
228
+
229
+    public Test2Dbo[] getDbos() {
230
+        return _dbos;
231
+    }
232
+
233
+    public void setDbos(Test2Dbo[] dbos) {
234
+        _dbos = dbos;
235
+    }
236
+
237
+    public HashMap<String, Integer> getHashMap() {
238
+        return _hashMap;
239
+    }
240
+
241
+    public void setHashMap(HashMap<String, Integer> hashMap) {
242
+        _hashMap = hashMap;
243
+    }
244
+
245
+    public AbstractMap<String, Test2Dbo> getHashMap2() {
246
+        return _hashMap2;
247
+    }
248
+
249
+    public void setHashMap2(AbstractMap<String, Test2Dbo> hashMap2) {
250
+        _hashMap2 = hashMap2;
251
+    }
252
+
253
+    public String getaNullString() {
254
+        return _aNullString;
255
+    }
256
+
257
+    public void setaNullString(String aNullString) {
258
+        _aNullString = aNullString;
259
+    }
260
+
261
+    public Class getObject() {
262
+        return _object;
263
+    }
264
+
265
+    public void setObject(Class object) {
266
+        _object = object;
267
+    }
268
+
269
+    public String getTransientField() {
270
+        return _transientField;
271
+    }
272
+
273
+    public void setTransientField(String transientField) {
274
+        _transientField = transientField;
275
+    }
276
+
277
+    @Override
278
+    public boolean equals(Object o) {
279
+        if (this == o) return true;
280
+        if (o == null || getClass() != o.getClass()) return false;
281
+
282
+        TestDbo testDbo = (TestDbo) o;
283
+
284
+        if (_byte != testDbo._byte) return false;
285
+        if (_char != testDbo._char) return false;
286
+        if (_short != testDbo._short) return false;
287
+        if (_int != testDbo._int) return false;
288
+        if (_long != testDbo._long) return false;
289
+        if (Float.compare(testDbo._float, _float) != 0) return false;
290
+        if (Double.compare(testDbo._double, _double) != 0) return false;
291
+        if (_boolean != testDbo._boolean) return false;
292
+        if (_byteObject != null ? !_byteObject.equals(testDbo._byteObject) : testDbo._byteObject != null)
293
+            return false;
294
+        if (_charObject != null ? !_charObject.equals(testDbo._charObject) : testDbo._charObject != null)
295
+            return false;
296
+        if (_shortObject != null ? !_shortObject.equals(testDbo._shortObject) : testDbo._shortObject != null)
297
+            return false;
298
+        if (_intObject != null ? !_intObject.equals(testDbo._intObject) : testDbo._intObject != null)
299
+            return false;
300
+        if (_longObject != null ? !_longObject.equals(testDbo._longObject) : testDbo._longObject != null)
301
+            return false;
302
+        if (_floatObject != null ? !_floatObject.equals(testDbo._floatObject) : testDbo._floatObject != null)
303
+            return false;
304
+        if (_doubleObject != null ? !_doubleObject.equals(testDbo._doubleObject) : testDbo._doubleObject != null)
305
+            return false;
306
+        if (_booleanObject != null ? !_booleanObject.equals(testDbo._booleanObject) : testDbo._booleanObject != null)
307
+            return false;
308
+        if (_string != null ? !_string.equals(testDbo._string) : testDbo._string != null)
309
+            return false;
310
+        if (_test2Dbo != null ? !_test2Dbo.equals(testDbo._test2Dbo) : testDbo._test2Dbo != null)
311
+            return false;
312
+        if (_test2Dbo2 != null ? !_test2Dbo2.equals(testDbo._test2Dbo2) : testDbo._test2Dbo2 != null)
313
+            return false;
314
+        if (_integers != null ? !_integers.equals(testDbo._integers) : testDbo._integers != null)
315
+            return false;
316
+        if (!Arrays.equals(_ints, testDbo._ints)) return false;
317
+        if (_test2Dbos != null ? !_test2Dbos.equals(testDbo._test2Dbos) : testDbo._test2Dbos != null)
318
+            return false;
319
+        // Probably incorrect - comparing Object[] arrays with Arrays.equals
320
+        if (!Arrays.equals(_dbos, testDbo._dbos)) return false;
321
+        if (_hashMap != null ? !_hashMap.equals(testDbo._hashMap) : testDbo._hashMap != null)
322
+            return false;
323
+        if (_hashMap2 != null ? !_hashMap2.equals(testDbo._hashMap2) : testDbo._hashMap2 != null)
324
+            return false;
325
+        if (_aNullString != null ? !_aNullString.equals(testDbo._aNullString) : testDbo._aNullString != null)
326
+            return false;
327
+        return _object != null ? _object.equals(testDbo._object) : testDbo._object == null;
328
+
329
+    }
330
+
331
+    @Override
332
+    public int hashCode() {
333
+        int result;
334
+        long temp;
335
+        result = (int) _byte;
336
+        result = 31 * result + (int) _char;
337
+        result = 31 * result + (int) _short;
338
+        result = 31 * result + _int;
339
+        result = 31 * result + (int) (_long ^ (_long >>> 32));
340
+        result = 31 * result + (_float != +0.0f ? Float.floatToIntBits(_float) : 0);
341
+        temp = Double.doubleToLongBits(_double);
342
+        result = 31 * result + (int) (temp ^ (temp >>> 32));
343
+        result = 31 * result + (_boolean ? 1 : 0);
344
+        result = 31 * result + (_byteObject != null ? _byteObject.hashCode() : 0);
345
+        result = 31 * result + (_charObject != null ? _charObject.hashCode() : 0);
346
+        result = 31 * result + (_shortObject != null ? _shortObject.hashCode() : 0);
347
+        result = 31 * result + (_intObject != null ? _intObject.hashCode() : 0);
348
+        result = 31 * result + (_longObject != null ? _longObject.hashCode() : 0);
349
+        result = 31 * result + (_floatObject != null ? _floatObject.hashCode() : 0);
350
+        result = 31 * result + (_doubleObject != null ? _doubleObject.hashCode() : 0);
351
+        result = 31 * result + (_booleanObject != null ? _booleanObject.hashCode() : 0);
352
+        result = 31 * result + (_string != null ? _string.hashCode() : 0);
353
+        result = 31 * result + (_test2Dbo != null ? _test2Dbo.hashCode() : 0);
354
+        result = 31 * result + (_test2Dbo2 != null ? _test2Dbo2.hashCode() : 0);
355
+        result = 31 * result + (_integers != null ? _integers.hashCode() : 0);
356
+        result = 31 * result + Arrays.hashCode(_ints);
357
+        result = 31 * result + (_test2Dbos != null ? _test2Dbos.hashCode() : 0);
358
+        result = 31 * result + Arrays.hashCode(_dbos);
359
+        result = 31 * result + (_hashMap != null ? _hashMap.hashCode() : 0);
360
+        result = 31 * result + (_hashMap2 != null ? _hashMap2.hashCode() : 0);
361
+        result = 31 * result + (_aNullString != null ? _aNullString.hashCode() : 0);
362
+        result = 31 * result + (_object != null ? _object.hashCode() : 0);
363
+        return result;
364
+    }
365
+}

+ 188
- 0
luticateutils/src/test/java/com/luticate/utils/TestDboTest.java Ver arquivo

@@ -0,0 +1,188 @@
1
+package com.luticate.utils;
2
+
3
+import org.json.JSONObject;
4
+import org.junit.Test;
5
+
6
+import static org.junit.Assert.*;
7
+
8
+/**
9
+ * Created by robin on 10/20/16.
10
+ */
11
+
12
+public class TestDboTest {
13
+
14
+    public static String TEST_DBO_JSON =  "{" +
15
+            "\"byte\": 42," +
16
+            "\"char\": \"h\"," +
17
+            "\"short\": 4200," +
18
+            "\"int\": 420042," +
19
+            "\"long\": 42004200," +
20
+            "\"float\": 42.24," +
21
+            "\"double\": 4200.0024," +
22
+            "\"boolean\": true," +
23
+
24
+            "\"byteObject\": 24," +
25
+            "\"charObject\": \"w\"," +
26
+            "\"shortObject\": 2400," +
27
+            "\"intObject\": 240024," +
28
+            "\"longObject\": 24002400," +
29
+            "\"floatObject\": 24.42," +
30
+            "\"doubleObject\": 2400.0042," +
31
+            "\"booleanObject\": false," +
32
+
33
+            "\"string\": \"Hello World!\"," +
34
+
35
+            "\"test2Dbo\": {" +
36
+            "\"aString\": \"a string\"," +
37
+            "\"aInt\": 4242" +
38
+            "}," +
39
+
40
+            "\"integers\": [" +
41
+            "0," +
42
+            "42," +
43
+            "24" +
44
+            "]," +
45
+            "ints: [" +
46
+            "24," +
47
+            "42," +
48
+            "0" +
49
+            "]," +
50
+
51
+            "test2Dbos: [" +
52
+            "{" +
53
+            "\"aString\": \"42 42\"," +
54
+            "\"aInt\": 4242" +
55
+            "}" +
56
+            "]," +
57
+            "dbos: [" +
58
+            "{" +
59
+            "\"aString\": \"24 24\"," +
60
+            "\"aInt\": 2424" +
61
+            "}" +
62
+            "]," +
63
+
64
+            "\"hashMap\": {" +
65
+            "\"forty-two\": 42," +
66
+            "\"twenty-four\": 24" +
67
+            "}," +
68
+
69
+            "\"hashMap2\": {" +
70
+            "\"an object\": {" +
71
+            "\"aString\": \"42 24\"," +
72
+            "\"aInt\": 4224" +
73
+            "}" +
74
+            "}," +
75
+
76
+            "\"aNullString\": null," +
77
+
78
+            "\"object\": {}," +
79
+
80
+            "\"transientField\": \"a transient field\"" +
81
+
82
+            "}";
83
+
84
+    public void testTestDbo(TestDbo test)
85
+    {
86
+        assertEquals(42, test.getByte());
87
+        assertEquals(24, test.getByteObject().byteValue());
88
+        assertEquals('h', test.getChar());
89
+        assertEquals('w', test.getCharObject().charValue());
90
+        assertEquals(4200, test.getShort());
91
+        assertEquals(2400, test.getShortObject().shortValue());
92
+        assertEquals(420042, test.getInt());
93
+        assertEquals(240024, test.getIntObject().intValue());
94
+        assertEquals(42004200, test.getLong());
95
+        assertEquals(24002400, test.getLongObject().longValue());
96
+        assertEquals(42.24, test.getFloat(), 0.1);
97
+        assertEquals(24.42, test.getFloatObject(), 0.1);
98
+        assertEquals(4200.0024, test.getDouble(), 0.1);
99
+        assertEquals(2400.0042, test.getDoubleObject(), 0.1);
100
+        assertEquals(true, test.isBoolean());
101
+        assertEquals(false, test.getBooleanObject());
102
+        assertEquals("Hello World!", test.getString());
103
+
104
+        assertNotNull(test.getTest2Dbo());
105
+        assertEquals("a string", test.getTest2Dbo().getaString());
106
+        assertEquals(4242, test.getTest2Dbo().getaInt());
107
+        assertNull(test.getTest2Dbo2());
108
+
109
+        assertNotNull(test.getIntegers());
110
+        assertEquals(3, test.getIntegers().size());
111
+        assertEquals(0, test.getIntegers().get(0).intValue());
112
+        assertEquals(42, test.getIntegers().get(1).intValue());
113
+        assertEquals(24, test.getIntegers().get(2).intValue());
114
+
115
+        assertNotNull(test.getInts());
116
+        assertEquals(3, test.getInts().length);
117
+        assertEquals(24, test.getInts()[0]);
118
+        assertEquals(42, test.getInts()[1]);
119
+        assertEquals(0, test.getInts()[2]);
120
+
121
+        assertNotNull(test.getTest2Dbos());
122
+        assertEquals(1, test.getTest2Dbos().size());
123
+        assertNotNull(test.getTest2Dbos().get(0));
124
+        assertEquals("42 42", test.getTest2Dbos().get(0).getaString());
125
+        assertEquals(4242, test.getTest2Dbos().get(0).getaInt());
126
+
127
+        assertNotNull(test.getDbos());
128
+        assertEquals(1, test.getDbos().length);
129
+        assertNotNull(test.getDbos()[0]);
130
+        assertEquals("24 24", test.getDbos()[0].getaString());
131
+        assertEquals(2424, test.getDbos()[0].getaInt());
132
+
133
+        assertNotNull(test.getHashMap());
134
+        assertEquals(2, test.getHashMap().size());
135
+        assertTrue(test.getHashMap().containsKey("forty-two"));
136
+        assertEquals(42, (int)test.getHashMap().get("forty-two"));
137
+        assertTrue(test.getHashMap().containsKey("twenty-four"));
138
+        assertEquals(24, (int)test.getHashMap().get("twenty-four"));
139
+
140
+        assertNotNull(test.getHashMap2());
141
+        assertEquals(1, test.getHashMap2().size());
142
+        assertTrue(test.getHashMap2().containsKey("an object"));
143
+        assertNotNull(test.getHashMap2().get("an object"));
144
+        assertEquals("42 24", test.getHashMap2().get("an object").getaString());
145
+        assertEquals(4224, test.getHashMap2().get("an object").getaInt());
146
+
147
+        assertNull(test.getaNullString());
148
+        assertNull(test.getObject());
149
+
150
+        assertNull(test.getTransientField());
151
+
152
+        assertEquals(test, test);
153
+    }
154
+
155
+    @Test
156
+    public void deserializeTest() throws Exception {
157
+        TestDbo test = new TestDbo();
158
+        test.fromJson(TEST_DBO_JSON);
159
+        testTestDbo(test);
160
+    }
161
+
162
+    @Test
163
+    public void serializeTest() throws Exception
164
+    {
165
+        TestDbo test = new TestDbo();
166
+        test.fromJson(TEST_DBO_JSON);
167
+        JSONObject json = test.toJson();
168
+
169
+        assertFalse(json.has("transientField"));
170
+
171
+        TestDbo test2 = new TestDbo();
172
+        test2.fromJson(json);
173
+
174
+        testTestDbo(test2);
175
+    }
176
+
177
+    @Test
178
+    public void serializeStringTest() throws Exception
179
+    {
180
+        TestDbo test = new TestDbo();
181
+        test.fromJson(TEST_DBO_JSON);
182
+
183
+        TestDbo test2 = new TestDbo();
184
+        test2.fromJson(test.toString());
185
+
186
+        testTestDbo(test2);
187
+    }
188
+}

+ 1
- 0
settings.gradle Ver arquivo

@@ -0,0 +1 @@
1
+include ':luticateutils'

Carregando…
Cancelar
Salvar