diff --git a/.classpath b/.classpath
new file mode 100644
index 0000000..f0257c5
--- /dev/null
+++ b/.classpath
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.gitignore b/.gitignore
index b2e5a4f..907c9d9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,15 @@
-/dist/
-build
+target/
+pom.xml.tag
+pom.xml.releaseBackup
+pom.xml.versionsBackup
+pom.xml.next
+release.properties
+dependency-reduced-pom.xml
+buildNumber.properties
+.mvn/timing.properties
+# https://github.com/takari/maven-wrapper#usage-without-binary-jar
+.mvn/wrapper/maven-wrapper.jar
+
ids.txt
-nbproject/private
+build/
+dist/
diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644
index 431e4a8..0000000
--- a/.gitmodules
+++ /dev/null
@@ -1,3 +0,0 @@
-[submodule "src/JSON-java"]
- path = src/JSON-java
- url = https://github.com/stleary/JSON-java
diff --git a/.project b/.project
new file mode 100644
index 0000000..a6d729a
--- /dev/null
+++ b/.project
@@ -0,0 +1,34 @@
+
+
+ s2s
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.m2e.core.maven2Builder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+ org.eclipse.m2e.core.maven2Nature
+
+
+
+ 1615207284547
+
+ 30
+
+ org.eclipse.core.resources.regexFilterMatcher
+ node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
+
+
+
+
diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..f9fe345
--- /dev/null
+++ b/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,4 @@
+eclipse.preferences.version=1
+encoding//src/main/java=UTF-8
+encoding//src/test/java=UTF-8
+encoding/=UTF-8
diff --git a/.settings/org.eclipse.jdt.apt.core.prefs b/.settings/org.eclipse.jdt.apt.core.prefs
new file mode 100644
index 0000000..d4313d4
--- /dev/null
+++ b/.settings/org.eclipse.jdt.apt.core.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.apt.aptEnabled=false
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..1b6e1ef
--- /dev/null
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,9 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
+org.eclipse.jdt.core.compiler.processAnnotations=disabled
+org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..c5f3f6b
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,3 @@
+{
+ "java.configuration.updateBuildConfiguration": "interactive"
+}
\ No newline at end of file
diff --git a/src/LICENSE b/LICENSE
similarity index 99%
rename from src/LICENSE
rename to LICENSE
index 261eeb9..e72929e 100644
--- a/src/LICENSE
+++ b/LICENSE
@@ -199,3 +199,4 @@
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.
+
\ No newline at end of file
diff --git a/README.md b/README.md
index 51bdd4f..c5a0448 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,4 @@
# brainclouds2s-java
-Version 3.11
Java library for brainCloud S2S
@@ -16,17 +15,19 @@ clone the repo.
```
git clone https://github.com/getbraincloud/brainclouds2s-java.git
-cd brainclouds2s-java
-git submodule update --init --recursive --remote
-./autobuild/build.sh
```
-The resulting jar file is in **dist/Brainclouds2s-x.x.jar**
+
+Build using maven
+```
+mvn package
+```
+The resulting jar file is in **target/brainclouds2s-x.x.x.jar**
## Sample Usage
### Using included org.json encoding/decoding
``` java
- import com.bitheads.braincloud.s2s.Brainclouds2s;
+ import com.bitheads.brainclouds2s.BrainCloudS2S;
import org.json.JSONArray;
import org.json.JSONObject;
@@ -34,7 +35,7 @@ The resulting jar file is in **dist/Brainclouds2s-x.x.jar**
String serverName = "";
String serverSecret = "";
- Brainclouds2s instance = new Brainclouds2s();
+ BrainCloudS2S instance = new BrainCloudS2S();
instance.init(appId, serverName, serverSecret);
JSONObject json = new JSONObject();
@@ -53,7 +54,7 @@ The resulting jar file is in **dist/Brainclouds2s-x.x.jar**
params.put("maxReturn", 5); // Max 5 entity
json.put("data",params);
- instance.request(json, (Brainclouds2s context, JSONObject jsonData) -> {
+ instance.request(json, (BrainCloudS2S context, JSONObject jsonData) -> {
if (jsonData.getInt("status").isEqual(200)) {
JSONArray list = jsonData.getJSONObject("data").getJSONArray("entityList");
// Now list contains the address entities.
@@ -62,7 +63,7 @@ The resulting jar file is in **dist/Brainclouds2s-x.x.jar**
});
```
-### Using Your own JSON encoding/deocoding
+### Using Your own JSON encoding/decoding
``` java
import com.bitheads.braincloud.s2s.Brainclouds2s;
@@ -73,12 +74,12 @@ The resulting jar file is in **dist/Brainclouds2s-x.x.jar**
String serverName = "";
String serverSecret = "";
- Brainclouds2s instance = new Brainclouds2s();
+ BrainCloudS2S instance = new BrainCloudS2S();
instance.init(appId, serverName, serverSecret);
String requestString ="{\"service\":\"globalEntity", \"operation\":\"READ__LIST\",\"data\":{\"where\":{\"entityType\":\"address\"},\"orderBy\":{\"data.address\":1},\"maxReturn\":50}";
- instance.request(requestString, (Brainclouds2s context, String jsonString) -> {
+ instance.request(requestString, (BrainCloudS2S context, String jsonString) -> {
// decode and evaluate jsonString
// Your code here.
});
diff --git a/autobuild/build.sh b/autobuild/build.sh
old mode 100755
new mode 100644
index 22f153a..efc453a
--- a/autobuild/build.sh
+++ b/autobuild/build.sh
@@ -3,25 +3,8 @@
# Go to project root
cd `dirname $0`/..
-if [ ! -f version.txt ]; then
- echo "Missing version.txt file, must contain onle line with the current version of the source."
- exit 1
-fi
+# Create jar file
+mvn package
-VERSION=`cat version.txt`
-
-#Get Version from arguments if present
-if [ -n "$1" ]; then
- VERSION=$1
-fi
-
-echo "Building Brainclouds2s... "
-mkdir -p build
-javac -d ./build `find ./src -name "*.java"`
-cp src/LICENSE build/
-
-echo "Packacking Brainclouds2s-$VERSION.jar..."
-mkdir -p dist
-cd ./build
-jar -cf ../dist/Brainclouds2s-$VERSION.jar `find . -name "*.class"` LICENSE
+# Feedback
echo "Done."
diff --git a/autobuild/test.sh b/autobuild/test.sh
old mode 100755
new mode 100644
index b38cdd7..3c7a3de
--- a/autobuild/test.sh
+++ b/autobuild/test.sh
@@ -3,22 +3,6 @@
# Go to project root
cd `dirname $0`/..
-VERSION=`cat version.txt`
+# Run Tests
+mvn test
-# Make sure it is already built
-if [ ! -f dist/Brainclouds2s-$VERSION.jar ]; then
- autobuild/build.sh
-fi
-
-# Set a temporary build folder
-mkdir -p testBuild
-javac -cp lib/junit-4.12.jar:dist/Brainclouds2s-$VERSION.jar -d ./testBuild `find ./test -name "*.java"`
-java -cp lib/junit-4.12.jar:lib/hamcrest-core-1.3.jar:dist/Brainclouds2s-$VERSION.jar:testBuild/ org.junit.runner.JUnitCore com.bitheads.braincloud.s2s.Brainclouds2sSetupTest
-# Persist test results
-TEST_RESULT=$?
-
-# Cleanup
-rm -rf testBuild
-
-# Return test resutls
-exit $TEST_RESULT
\ No newline at end of file
diff --git a/build.xml b/build.xml
deleted file mode 100644
index d2e189e..0000000
--- a/build.xml
+++ /dev/null
@@ -1,73 +0,0 @@
-
-
-
-
-
-
-
-
-
-
- Builds, tests, and runs the project brainclouds2s-java.
-
-
-
diff --git a/lib/hamcrest-core-1.3.jar b/lib/hamcrest-core-1.3.jar
deleted file mode 100644
index 9d5fe16..0000000
Binary files a/lib/hamcrest-core-1.3.jar and /dev/null differ
diff --git a/lib/junit-4.12.jar b/lib/junit-4.12.jar
deleted file mode 100644
index 3a7fc26..0000000
Binary files a/lib/junit-4.12.jar and /dev/null differ
diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml
deleted file mode 100644
index 902b8fe..0000000
--- a/nbproject/build-impl.xml
+++ /dev/null
@@ -1,1769 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Must set src.dir
- Must set test.src.dir
- Must set build.dir
- Must set dist.dir
- Must set build.classes.dir
- Must set dist.javadoc.dir
- Must set build.test.classes.dir
- Must set build.test.results.dir
- Must set build.classes.excludes
- Must set dist.jar
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Must set javac.includes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- No tests executed.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Must set JVM to use for profiling in profiler.info.jvm
- Must set profiler agent JVM arguments in profiler.info.jvmargs.agent
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Must select some files in the IDE or set javac.includes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- To run this application from the command line without Ant, try:
-
- java -jar "${dist.jar.resolved}"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Must select one file in the IDE or set run.class
-
-
-
- Must select one file in the IDE or set run.class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Must select one file in the IDE or set debug.class
-
-
-
-
- Must select one file in the IDE or set debug.class
-
-
-
-
- Must set fix.includes
-
-
-
-
-
-
-
-
-
- This target only works when run from inside the NetBeans IDE.
-
-
-
-
-
-
-
-
- Must select one file in the IDE or set profile.class
- This target only works when run from inside the NetBeans IDE.
-
-
-
-
-
-
-
-
- This target only works when run from inside the NetBeans IDE.
-
-
-
-
-
-
-
-
-
-
-
-
- This target only works when run from inside the NetBeans IDE.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Must select one file in the IDE or set run.class
-
-
-
-
-
- Must select some files in the IDE or set test.includes
-
-
-
-
- Must select one file in the IDE or set run.class
-
-
-
-
- Must select one file in the IDE or set applet.url
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Must select some files in the IDE or set javac.includes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Some tests failed; see details above.
-
-
-
-
-
-
-
-
- Must select some files in the IDE or set test.includes
-
-
-
- Some tests failed; see details above.
-
-
-
- Must select some files in the IDE or set test.class
- Must select some method in the IDE or set test.method
-
-
-
- Some tests failed; see details above.
-
-
-
-
- Must select one file in the IDE or set test.class
-
-
-
- Must select one file in the IDE or set test.class
- Must select some method in the IDE or set test.method
-
-
-
-
-
-
-
-
-
-
-
-
-
- Must select one file in the IDE or set applet.url
-
-
-
-
-
-
-
-
- Must select one file in the IDE or set applet.url
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties
deleted file mode 100644
index 22b2133..0000000
--- a/nbproject/genfiles.properties
+++ /dev/null
@@ -1,8 +0,0 @@
-build.xml.data.CRC32=e569acf8
-build.xml.script.CRC32=94478a35
-build.xml.stylesheet.CRC32=f85dc8f2@1.90.1.48
-# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
-# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
-nbproject/build-impl.xml.data.CRC32=e569acf8
-nbproject/build-impl.xml.script.CRC32=6dd838f1
-nbproject/build-impl.xml.stylesheet.CRC32=3a2fa800@1.90.1.48
diff --git a/nbproject/project.properties b/nbproject/project.properties
deleted file mode 100644
index 031906c..0000000
--- a/nbproject/project.properties
+++ /dev/null
@@ -1,87 +0,0 @@
-annotation.processing.enabled=true
-annotation.processing.enabled.in.editor=false
-annotation.processing.processor.options=
-annotation.processing.processors.list=
-annotation.processing.run.all.processors=true
-annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
-build.classes.dir=${build.dir}/classes
-build.classes.excludes=**/*.java,**/*.form
-# This directory is removed when the project is cleaned:
-build.dir=build
-build.generated.dir=${build.dir}/generated
-build.generated.sources.dir=${build.dir}/generated-sources
-# Only compile against the classpath explicitly listed here:
-build.sysclasspath=ignore
-build.test.classes.dir=${build.dir}/test/classes
-build.test.results.dir=${build.dir}/test/results
-# Uncomment to specify the preferred debugger connection transport:
-#debug.transport=dt_socket
-debug.classpath=\
- ${run.classpath}
-debug.modulepath=\
- ${run.modulepath}
-debug.test.classpath=\
- ${run.test.classpath}
-debug.test.modulepath=\
- ${run.test.modulepath}
-# Files in build.classes.dir which should be excluded from distribution jar
-dist.archive.excludes=
-# This directory is removed when the project is cleaned:
-dist.dir=dist
-dist.jar=${dist.dir}/brainclouds2s-java.jar
-dist.javadoc.dir=${dist.dir}/javadoc
-excludes=
-includes=**
-jar.compress=false
-javac.classpath=
-# Space-separated list of extra javac options
-javac.compilerargs=
-javac.deprecation=false
-javac.external.vm=true
-javac.modulepath=
-javac.processormodulepath=
-javac.processorpath=\
- ${javac.classpath}
-javac.source=1.8
-javac.target=1.8
-javac.test.classpath=\
- ${javac.classpath}:\
- ${build.classes.dir}:\
- ${libs.junit_4.classpath}:\
- ${libs.hamcrest.classpath}
-javac.test.modulepath=\
- ${javac.modulepath}
-javac.test.processorpath=\
- ${javac.test.classpath}
-javadoc.additionalparam=
-javadoc.author=false
-javadoc.encoding=${source.encoding}
-javadoc.noindex=false
-javadoc.nonavbar=false
-javadoc.notree=false
-javadoc.private=false
-javadoc.splitindex=true
-javadoc.use=true
-javadoc.version=false
-javadoc.windowtitle=
-main.class=com.bitheads.braincloud.s2s.main
-meta.inf.dir=${src.dir}/META-INF
-mkdist.disabled=true
-platform.active=default_platform
-run.classpath=\
- ${javac.classpath}:\
- ${build.classes.dir}
-# Space-separated list of JVM arguments used when running the project.
-# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
-# To set system properties for unit tests define test-sys-prop.name=value:
-run.jvmargs=
-run.modulepath=\
- ${javac.modulepath}
-run.test.classpath=\
- ${javac.test.classpath}:\
- ${build.test.classes.dir}
-run.test.modulepath=\
- ${javac.test.modulepath}
-source.encoding=UTF-8
-src.dir=src
-test.src.dir=test
diff --git a/nbproject/project.xml b/nbproject/project.xml
deleted file mode 100644
index e8c5205..0000000
--- a/nbproject/project.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
- org.netbeans.modules.java.j2seproject
-
-
- brainclouds2s-java
-
-
-
-
-
-
-
-
-
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..a9232c2
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,30 @@
+
+
+
+ 4.0.0
+ com.bitheads
+ brainclouds2s
+ 4.7.0
+ jar
+
+
+
+ org.json
+ json
+ 20180130
+
+
+ junit
+ junit
+ 4.13.2
+ test
+
+
+
+
+ UTF-8
+ 1.8
+ 1.8
+
+
+
diff --git a/src/JSON-java b/src/JSON-java
deleted file mode 160000
index 37f5bf2..0000000
--- a/src/JSON-java
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 37f5bf28e96d9dee03a4b97728cc2976f9c248c7
diff --git a/src/com/bitheads/braincloud/s2s/ReasonCodes.java b/src/com/bitheads/braincloud/s2s/ReasonCodes.java
deleted file mode 100644
index d6bfb5c..0000000
--- a/src/com/bitheads/braincloud/s2s/ReasonCodes.java
+++ /dev/null
@@ -1,435 +0,0 @@
-package com.bitheads.braincloud.client;
-
-
-public interface ReasonCodes {
-
- int NO_REASON_CODE = 0;
- int OK = 0;
- int INVALID_NOTIFICATION = 20200;
- int INVALID_REQUEST = 40001;
- int SWITCHING_FACEBOOK_MEMORY = 40201;
- int MERGING_MEMORY = 40202;
- int RECREATING_ANONYMOUS_MEMORY = 40203;
- int RESETING_MEMORY = 40203;
- int MOVING_ANONYMOUS_MEMORY = 40204;
- int LOGIN_SECURITY_ERROR = 40205;
- int MISSING_IDENTITY_ERROR = 40206;
- int SWITCHING_PROFILES = 40207;
- int MISSING_PROFILE_ERROR = 40208;
- int SECURITY_ERROR = 40209;
- int DOWNGRADING_TO_ANONYMOUS_ERROR = 40210;
- int DUPLICATE_IDENTITY_TYPE = 40211;
- int MERGE_PROFILES = 40212;
- int INVALID_PROPERTY_NAME = 40213;
- int EMAIL_NOT_VALIDATED = 40214;
- int DATABASE_ERROR = 40215;
- int PROPERTY_NOT_OVERRIDEABLE = 40216;
- int UNKNOWN_AUTH_ERROR = 40217;
- int DATABASE_INPUT_TOO_LARGE_ERROR = 40218;
- int MISSING_APP_EMAIL_ACCOUNT = 40219;
- int UNABLE_TO_GET_FRIENDS_FROM_FACEBOOK = 40300;
- int BAD_SIGNATURE = 40301;
- int UNABLE_TO_VALIDATE_PLAYER = 40302;
- int PLAYER_SESSION_EXPIRED = 40303;
- int USER_SESSION_EXPIRED = 40303;
- int NO_SESSION = 40304;
- int PLAYER_SESSION_MISMATCH = 40305;
- int USER_SESSION_MISMATCH = 40305;
- int OPERATION_REQUIRES_A_SESSION = 40306;
- int TOKEN_DOES_NOT_MATCH_USER = 40307;
- int EVENT_CAN_ONLY_SEND_TO_FRIEND_OR_SELF = 40309;
- int NOT_FRIENDS = 40310;
- int VC_BALANCE_CANNOT_BE_SPECIFIED = 40311;
- int VC_LIMIT_EXCEEDED = 40312;
- int UNABLE_TO_GET_MY_DATA_FROM_FACEBOOK = 40313;
- int INVALID_AUTHENTICATION_TYPE = 40315;
- int INVALID_GAME_ID = 40316;
- int APPLE_TRANS_ID_ALREADY_CLAIMED = 40317;
- int CLIENT_VERSION_NOT_SUPPORTED = 40318;
- int BRAINCLOUD_VERSION_NOT_SUPPORTED = 40319;
- int PLATFORM_NOT_SUPPORTED = 40320;
- int INVALID_PLAYER_STATISTICS_EVENT_NAME = 40321;
- int GAME_VERSION_NOT_SUPPORTED = 40322;
- int BAD_REFERENCE_DATA = 40324;
- int MISSING_OAUTH_TOKEN = 40325;
- int MISSING_OAUTH_VERIFIER = 40326;
- int MISSING_OAUTH_TOKEN_SECRET = 40327;
- int MISSING_TWEET = 40328;
- int FACEBOOK_PAYMENT_ID_ALREADY_PROCESSED = 40329;
- int DISABLED_GAME = 40330;
- int MATCH_MAKING_DISABLED = 40331;
- int UPDATE_FAILED = 40332;
- int INVALID_OPERATION = 40333;
- int MATCH_RANGE_ERROR = 40334;
- int PLAYER_IN_MATCH = 40335;
- int MATCH_PLAYER_SHIELDED = 40336;
- int MATCH_PLAYER_MISSING = 40337;
- int MATCH_PLAYER_LOGGED_IN = 40338;
- int INVALID_ITEM_ID = 40339;
- int MISSING_PRICE = 40340;
- int MISSING_USER_INFO = 40341;
- int MISSING_STEAM_RESPONSE = 40342;
- int MISSING_STEAM_TRANSACTION = 40343;
- int ENTITY_VERSION_MISMATCH = 40344;
- int MISSING_RECORD = 40345;
- int INSUFFICIENT_PERMISSIONS = 40346;
- int MISSING_IN_QUERY = 40347;
- int INVALID_DATABASE_FIELD_NAME = 40347;
- int RECORD_EXPIRED = 40348;
- int INVALID_WHERE = 40349;
- int S3_ERROR = 40350;
- int INVALID_ATTRIBUTES = 40351;
- int IMPORT_MISSING_GAME_DATA = 40352;
- int IMPORT_SCHEMA_VERSION_TOO_OLD = 40353;
- int IMPORT_SCHEMA_VERSION_INVALID = 40355;
- int PLAYER_SESSION_LOGGED_OUT = 40356;
- int API_HOOK_SCRIPT_ERROR = 40357;
- int MISSING_REQUIRED_PARAMETER = 40358;
- int INVALID_PARAMETER_TYPE = 40359;
- int INVALID_IDENTITY_TYPE = 40360;
- int EMAIL_SEND_ERROR = 40361;
- int CHILD_ENTITY_PARTIAL_UPDATE_INVALID_DATA = 40362;
- int MISSING_SCRIPT = 40363;
- int SCRIPT_SECURITY_ERROR = 40364;
- int SERVER_SESSION_EXPIRED = 40365;
- int STREAM_DOES_NOT_EXIT = 40366;
- int STREAM_ACCESS_ERROR = 40367;
- int STREAM_COMPLETE = 40368;
- int INVALID_STATISTIC_NAME = 40369;
- int INVALID_HTTP_REQUEST = 40370;
- int GAME_LIMIT_REACHED = 40371;
- int GAME_RUNSTATE_DISABLED = 40372;
- int INVALID_COMPANY_ID = 40373;
- int INVALID_PLAYER_ID = 40374;
- int INVALID_USER_ID = 40374;
- int INVALID_TEMPLATE_ID = 40375;
- int MINIMUM_SEARCH_INPUT = 40376;
- int MISSING_GAME_PARENT = 40377;
- int GAME_PARENT_MISMATCH = 40378;
- int CHILD_PLAYER_MISSING = 40379;
- int MISSING_PLAYER_PARENT = 40380;
- int PLAYER_PARENT_MISMATCH = 40381;
- int MISSING_PLAYER_ID = 40382;
- int DECODE_CONTEXT = 40383;
- int INVALID_QUERY_CONTEXT = 40384;
- int INVALID_AMOUNT = 40385;
- int GROUP_MEMBER_NOT_FOUND = 40385;
- int INVALID_SORT = 40386;
- int GAME_NOT_FOUND = 40387;
- int GAMES_NOT_IN_SAME_COMPANY = 40388;
- int IMPORT_NO_PARENT_ASSIGNED = 40389;
- int IMPORT_PARENT_CURRENCIES_MISMATCH = 40390;
- int INVALID_SUBSTITUION_ENTRY = 40391;
- int INVALID_TEMPLATE_STRING = 40392;
- int TEMPLATE_SUBSTITUTION_ERROR = 40393;
- int INVALID_OPPONENTS = 40394;
- int REDEMPTION_CODE_NOT_FOUND = 40395;
- int REDEMPTION_CODE_VERSION_MISMATCH = 40396;
- int REDEMPTION_CODE_ACTIVE = 40397;
- int REDEMPTION_CODE_NOT_ACTIVE = 40398;
- int REDEMPTION_CODE_TYPE_NOT_FOUND = 40399;
- int REDEMPTION_CODE_INVALID = 40400;
- int REDEMPTION_CODE_REDEEMED = 40401;
- int REDEMPTION_CODE_REDEEMED_BY_SELF = 40402;
- int REDEMPTION_CODE_REDEEMED_BY_OTHER = 40403;
- int SCRIPT_EMPTY = 40404;
- int ITUNES_COMMUNICATION_ERROR = 40405;
- int ITUNES_NO_RESPONSE = 40406;
- int ITUNES_RESPONSE_NOT_OK = 40407;
- int JSON_PARSING_ERROR = 40408;
- int ITUNES_NULL_RESPONSE = 40409;
- int ITUNES_RESPONSE_WITH_NULL_STATUS = 40410;
- int ITUNES_STATUS_BAD_JSON_RECEIPT = 40411;
- int ITUNES_STATUS_BAD_RECEIPT = 40412;
- int ITUNES_STATUS_RECEIPT_NOT_AUTHENTICATED = 40413;
- int ITUNES_STATUS_BAD_SHARED_SECRET = 40414;
- int ITUNES_STATUS_RECEIPT_SERVER_UNAVAILABLE = 40415;
- int ITUNES_RECEIPT_MISSING_ITUNES_PRODUCT_ID = 40416;
- int PRODUCT_NOT_FOUND_FOR_ITUNES_PRODUCT_ID = 40417;
- int DATA_STREAM_EVENTS_NOT_ENABLED = 40418;
- int INVALID_DEVICE_TOKEN = 40419;
- int ERROR_DELETING_DEVICE_TOKEN = 40420;
- int WEBPURIFY_NOT_CONFIGURED = 40421;
- int WEBPURIFY_EXCEPTION = 40422;
- int WEBPURIFY_FAILURE = 40423;
- int WEBPURIFY_NOT_ENABLED = 40424;
- int NAME_CONTAINS_PROFANITY = 40425;
- int NULL_SESSION = 40426;
- int PURCHASE_ALREADY_VERIFIED = 40427;
- int GOOGLE_IAP_NOT_CONFIGURED = 40428;
- int UPLOAD_FILE_TOO_LARGE = 40429;
- int FILE_ALREADY_EXISTS = 40430;
- int CLOUD_STORAGE_SERVICE_ERROR = 40431;
- int FILE_DOES_NOT_EXIST = 40432;
- int UPLOAD_ID_MISSING = 40433;
- int UPLOAD_JOB_MISSING = 40434;
- int UPLOAD_JOB_EXPIRED = 40435;
- int UPLOADER_EXCEPTION = 40436;
- int UPLOADER_FILESIZE_MISMATCH = 40437;
- int PUSH_NOTIFICATIONS_NOT_CONFIGURED = 40438;
- int MATCHMAKING_FILTER_SCRIPT_FAILURE = 40439;
- int ACCOUNT_ALREADY_EXISTS = 40440;
- int PROFILE_ALREADY_EXISTS = 40441;
- int MISSING_NOTIFICATION_BODY = 40442;
- int INVALID_SERVICE_CODE = 40443;
- int IP_ADDRESS_BLOCKED = 40444;
- int UNAPPROVED_SERVICE_CODE = 40445;
- int PROFILE_NOT_FOUND = 40446;
- int ENTITY_NOT_SHARED = 40447;
- int SELF_FRIEND = 40448;
- int PARSE_NOT_CONFIGURED = 40449;
- int PARSE_NOT_ENABLED = 40450;
- int PARSE_REQUEST_ERROR = 40451;
- int GROUP_CANNOT_ADD_OWNER = 40452;
- int NOT_GROUP_MEMBER = 40453;
- int INVALID_GROUP_ROLE = 40454;
- int GROUP_OWNER_DELETE = 40455;
- int NOT_INVITED_GROUP_MEMBER = 40456;
- int GROUP_IS_FULL = 40457;
- int GROUP_OWNER_CANNOT_LEAVE = 40458;
- int INVALID_INCREMENT_VALUE = 40459;
- int GROUP_VERSION_MISMATCH = 40460;
- int GROUP_ENTITY_VERSION_MISMATCH = 40461;
- int INVALID_GROUP_ID = 40462;
- int INVALID_FIELD_NAME = 40463;
- int UNSUPPORTED_AUTH_TYPE = 40464;
- int CLOUDCODE_JOB_NOT_FOUND = 40465;
- int CLOUDCODE_JOB_NOT_SCHEDULED = 40466;
- int GROUP_TYPE_NOT_FOUND = 40467;
- int MATCHING_GROUPS_NOT_FOUND = 40468;
- int GENERATE_CDN_URL_ERROR = 40469;
- int INVALID_PROFILE_IDS = 40470;
- int MAX_PROFILE_IDS_EXCEEDED = 40471;
- int PROFILE_ID_MISMATCH = 40472;
- int LEADERBOARD_DOESNOT_EXIST = 40473;
- int APP_LICENSING_EXCEEDED = 40474;
- int SENDGRID_NOT_INSTALLED = 40475;
- int SENDGRID_EMAIL_SEND_ERROR = 40476;
- int SENDGRID_NOT_ENABLED_FOR_APP = 40477;
- int SENDGRID_GET_TEMPLATES_ERROR = 40478;
- int SENDGRID_INVALID_API_KEY = 40479;
- int EMAIL_SERVICE_NOT_CONFIGURED = 40480;
- int INVALID_EMAIL_TEMPLATE_TYPE = 40481;
- int SENDGRID_KEY_EMPTY_OR_NULL = 40482;
- int BODY_TEMPLATE_CANNOT_COEXIST = 40483;
- int SUBSTITUTION_BODY_CANNOT_COEXIST = 40484;
- int INVALID_FROM_ADDRESS = 40485;
- int INVALID_FROM_NAME = 40486;
- int INVALID_REPLY_TO_ADDRESS = 40487;
- int INVALID_REPLY_TO_NAME = 40488;
- int FROM_NAME_WITHOUT_FROM_ADDRESS = 40489;
- int REPLY_TO_NAME_WITHOUT_REPLY_TO_ADDRESS = 40490;
- int CURRENCY_SECURITY_ERROR = 40491;
- int INVALID_PEER_CODE = 40492;
- int PEER_NO_LONGER_EXISTS = 40493;
- int CANNOT_MODIFY_TOURNAMENT_WITH_LEADERBOARD_SERVICE = 40494;
- int NO_TOURNAMENT_ASSOCIATED_WITH_LEADERBOARD = 40495;
- int TOURNAMENT_NOT_ASSOCIATED_WITH_LEADERBOARD = 40496;
- int PLAYER_ALREADY_TOURNAMENT_FOR_LEADERBOARD = 40497;
- int PLAYER_EARLY_FOR_JOINING_TOURNAMENT = 40498;
- int NO_LEADERBOARD_FOUND = 40499;
- int PLAYER_NOT_IN_TIME_RANGE_FOR_POSTSCORE_TOURNAMENT = 40500;
- int LEADERBOARD_ID_BAD = 40501;
- int SCORE_INPUT_BAD = 40502;
- int ROUND_STARTED_EPOCH_INPUT_BAD = 40503;
- int TOURNAMENT_CODE_INPUT_BAD = 40504;
- int PLAYER_NOT_ENROLLED_IN_TOURNAMENT = 40505;
- int LEADERBOARD_VERSION_ID_INVALID = 40506;
- int NOT_ENOUGH_BALANCE_TO_JOIN_TOURNAMENT = 40507;
- int PARENT_ALREADY_ATTACHED = 40508;
- int PEER_ALREADY_ATTACHED = 40509;
- int IDENTITY_NOT_ATTACHED_WITH_PARENT = 40510;
- int IDENTITY_NOT_ATTACHED_WITH_PEER = 40511;
- int LEADERBOARD_SCORE_UPDATE_ERROR = 40512;
- int ERROR_CLAIMING_REWARD = 40513;
- int NOT_ENOUGH_PARENT_BALANCE_TO_JOIN_TOURNAMENT = 40514;
- int NOT_ENOUGH_PEER_BALANCE_TO_JOIN_TOURNAMENT = 40515;
- int PLAYER_LATE_FOR_JOINING_TOURNAMENT = 40516;
- int VIEWING_REWARD_FOR_NON_PROCESSED_TOURNAMENTS = 40517;
- int NO_REWARD_ASSOCIATED_WITH_LEADERBOARD = 40518;
- int PROFILE_PEER_NOT_FOUND = 40519;
- int LEADERBOARD_IN_ACTIVE_STATE = 40520;
- int LEADERBOARD_IN_CALCULATING_STATE = 40521;
- int TOURNAMENT_RESULT_PROCESSING_FAILED = 40522;
- int TOURNAMENT_REWARDS_ALREADY_CLAIMED = 40523;
- int NO_TOURNAMENT_FOUND = 40524;
- int UNEXPECTED_ERROR_RANK_ZERO_AFTER_PROCESSING = 40525;
- int UNEXPECTED_ERROR_DELETING_TOURNAMENT_LEADERBOARD_SCORE = 40526;
- int INVALID_RUN_STATE = 40527;
- int LEADERBOARD_SCORE_DOESNOT_EXIST = 40528;
- int INITIAL_SCORE_NULL = 40529;
- int TOURNAMENT_NOTIFICATIONS_PROCESSING_FAILED = 40530;
- int ACL_NOT_READABLE = 40531;
- int INVALID_OWNER_ID = 40532;
- int IMPORT_MISSING_PEERS_DATA = 40533;
- int INVALID_CREDENTIAL = 40534;
- int GLOBAL_ENTITY_SECURITY_ERROR = 40535;
- int LEADERBOARD_SECURITY_ERROR = 40536;
- int NOT_A_SYSTEM_ENTITY = 40537;
- int CONTROLLER_ERROR = 40538;
- int EVENT_MISSING = 40539;
- int INVALID_XP_LEVEL = 40540;
- int INVALID_ITUNES_ID = 40541;
- int IMPORT_ERROR = 40542;
- int INVALID_ENTITY_TYPE = 40543;
- int FORM_ERROR = 40544;
- int INVALID_PARENT = 40545;
- int INVALID_CURRENCY = 40546;
- int INVALID_THRESHHOLD = 40547;
- int MATCH_ALREADY_EXISTS = 40548;
- int FRIEND_NOT_FOUND = 40549;
- int MATCH_NOT_FOUND = 40550;
- int MATCH_COMPLETE = 40551;
- int MATCH_NOT_STARTED = 40552;
- int MATCH_EXPIRED = 40553;
- int PLAYER_NOT_IN_MATCH = 40554;
- int INVALID_MATCH_VERSION = 40555;
- int INVALID_TURN_VERSION = 40556;
- int INVALID_DEVICE_TYPE = 40557;
- int DUPLICATE_ENTITY = 40558;
- int DUPLICATE_EVENT = 40559;
- int INVALID_LEADERBOARD_COUNT = 40560;
- int DUPLICATE_LEADERBOARD = 40561;
- int MICROSOFT_ERROR = 40562;
- int DUPLICATE_TOURNAMENT = 40563;
- int CREATE_SYSTEM_ENTITY_FAILED = 40564;
- int INVALID_MAX_NUM_STREAMS = 40565;
- int INVALID_PACKET_ID = 40566;
- int HOOK_ERROR = 40567;
- int INVALID_STREAM_ID = 40568;
- int INVALID_SCAN_CODE = 40569;
- int NO_CUSTOM_ENTITY_CONFIG_FOUND = 40570;
- int NO_CUSTOM_ENTITY_FOUND = 40571;
- int CLOUD_STORAGE_ERROR = 40572;
- int NO_CUSTOM_FIELD_CONFIG_FOUND = 40573;
- int MISSING_CUSTOM_ENTITY_QUERY = 40574;
- int INVALID_CUSTOM_ENTITY_JSON_WHERE = 40575;
- int INVALID_CUSTOM_ENTITY_JSON_FIELDS = 40576;
- int ENTITY_ID_NOT_CONFIGURED = 40577;
- int UNCONFIGURED_CUSTOM_FIELD_ERROR = 40578;
- int CUSTOM_ENTITY_SECURITY_ERROR = 40579;
- int CUSTOM_ENTITY_PARTIAL_UPDATE_INVALID_DATA = 40580;
- int TOURNAMENT_PLAY_HAS_NOT_STARTED = 40581;
- int TOURNAMENT_PLAY_HAS_ENDED = 40582;
- int NEW_CREDENTIAL_IN_USE = 40583;
- int OLD_CREDENTIAL_NOT_OWNED = 40584;
- int CLOUD_CODE_SECURITY_ERROR = 40585;
- int RTT_SERVER_NOT_FOUND = 40586;
- int RTT_CLIENT_NOT_FOUND = 40587;
- int NO_RTT_SERVERS_AVAILABLE = 40588;
- int PROFILE_SESSION_MISMATCH = 40589;
- int WAITING_FOR_ON_DEMAND_TOURNAMENT_TO_START = 40590;
- int CDN_URLS_NOT_SUPPORTED = 40591;
- int CLOUD_CONTAINER_ERROR = 40592;
- int MESSAGING_FEATURE_NOT_CONFIGURED = 40593;
- int CHAT_FEATURE_NOT_CONFIGURED = 40594;
- int MESSAGE_NOT_FOUND = 40595;
- int COLLECTION_CREATE_DISABLED = 40596;
- int LEADERBAORD_COLLECTION_CREATE_DISABLED = 40597;
- int MESSAGE_VERSION_MISMATCH = 40598;
- int MESSAGEBOX_VERSION_MISMATCH = 40599;
- int MESSAGE_TOO_LARGE = 40600;
- int FEATURE_NOT_ENABLED = 40601;
- int CHANNEL_NOT_FOUND = 40603;
- int MALFORMED_FORM_DATA = 40604;
- int MISSING_LAST_PACKET_RESPONSE = 40605;
- int PACKET_IN_PROGRESS = 40606;
- int LOBBY_MEMBER_NOT_FOUND = 40607;
- int LOBBY_TEAM_NOT_FOUND = 40608;
- int LOBBY_ENTRY_QUEUE_MEMBER_NOT_FOUND = 40609;
- int INVALID_HEADER_APP_ID = 40610;
- int LOBBY_TYPE_NOT_FOUND = 40611;
- int LOBBY_TEAM_FULL = 40612;
- int LOBBY_NOT_FOUND = 40613;
- int MESSAGE_CONTENT_INVALID_JSON = 40614;
- int RTT_FEATURE_NOT_CONFIGURED = 40615;
- int CLOUD_CODE_ONLY_METHOD = 40616;
- int MESSAGE_FROM_JSON_ID_MUST_BE_NULL = 40617;
- int MESSAGE_FROM_JSON_NAME_MANDATORY = 40618;
- int INVALID_LOBBY_STEP_ALIGNMENT = 40619;
- int INVALID_LOBBY_STEP_STRATEGY = 40620;
- int MESSAGING_MAX_RECIPIENTS_EXCEEDED = 40621;
- int LOBBY_FEATURE_NOT_CONFIGURED = 40622;
- int TOO_MANY_USERS_FOR_TEAM = 40623;
- int TOO_MANY_USERS_FOR_LOBBY_TYPE = 40624;
- int DIVISION_SET_DOESNOT_EXIST = 40625;
- int LOBBY_CONFIG_NOT_FOUND = 40626;
- int PRESENCE_NOT_INITIALIZED = 40627;
- int PRESENCE_FEATURE_NOT_CONFIGURED = 40628;
- int PLAYER_ALREADY_IN_ACTIVE_DIVISION_SET = 40629;
- int TOURNAMENT_CODE_MISSING = 40630;
- int ERROR_ASSIGNING_DIVISION_SET_INSTANCE = 40631;
- int LEADERBOARD_NOT_DIVISION_SET_INSTANCE = 40632;
- int DIVISION_SET_SCHEDULING_TYPE_DOES_NOT_EXIST = 40633;
- int PRESENCE_ACTIVITY_NOT_ENABLED = 40634;
- int PRESENCE_REALTIME_NOT_ENABLED = 40635;
- int DIVISION_SET_MAX_SIZE_REACHED = 40636;
- int DIVISION_SET_INFO_ERROR = 40637;
- int DIVISION_SET_API_MUST_BE_USED = 40638;
- int API_CALL_REJECTED = 40639;
- int LEADERBOARD_TOURNAMENT_TEMPLATE_ONLY = 40640;
- int INVALID_TOURNAMENT_JOB_ID = 40641;
- int LEADERBOARD_ROTATION_ERROR = 40642;
- int INVALID_STORE_ID = 40700;
- int METHOD_DEPRECATED = 40701;
- int INVALID_BILLING_PROVIDER_ID = 40702;
- int NO_TWITTER_CONSUMER_KEY = 500001;
- int NO_TWITTER_CONSUMER_SECRET = 500002;
- int INVALID_CONFIGURATION = 500003;
- int ERROR_GETTING_REQUEST_TOKEN = 500004;
- int ERROR_GETTING_ACCESS_TOKEN = 500005;
- int TWITTER_AUTH_ERROR = 500006;
- int TWITTER_ERROR = 500007;
- int FACEBOOK_ERROR = 500010;
- int FACEBOOK_SECRET_MISMATCH = 500011;
- int FACEBOOK_AUTHENTICATION_ERROR = 500012;
- int FACEBOOK_APPLICATION_TOKEN_REQUEST_ERROR = 500013;
- int FACEBOOK_BAD_APPLICATION_TOKEN_SIGNATURE = 500014;
- int NOT_TEAM_ADMIN = 550000;
- int NO_TEAM_ACCESS = 550001;
- int MISSING_COMPANY_RECORD = 550002;
- int TEAM_MEMBER_NOT_FOUND = 550003;
- int TEAM_MEMBER_NOT_ENABLED = 550004;
- int TEAM_MEMBER_NOT_ACTIVE = 550005;
- int TEAM_MEMBER_LOCKED = 550006;
- int INVALID_PASSWORD = 550007;
- int TOKEN_INVALID = 550008;
- int TOKEN_EXPIRED = 550009;
- int APP_NOT_FOUND = 550010;
- int TEMPLATE_GAME_NOT_FOUND = 550011;
- int INVALID_TEMPLATE_GAME_TEAM = 550012;
- int BASIC_AUTH_FAILURE = 550013;
- int MONGO_DB_EXCEPTION = 600001;
- int CONCURRENT_LOCK_ERROR = 600002;
- int RTT_LEFT_BY_CHOICE = 80000;
- int RTT_EVICTED = 80001;
- int RTT_LOST_CONNECTION = 80002;
- int RTT_TIMEOUT = 80100;
- int RTT_ROOM_READY = 80101;
- int RTT_ROOM_CANCELLED = 80102;
- int RTT_ERROR_ASSIGNING_ROOM = 80103;
- int RTT_ERROR_LAUNCHING_ROOM = 80104;
- int RTT_NO_LOBBIES_FOUND = 80200;
- int CLIENT_NETWORK_ERROR_TIMEOUT = 90001;
- int CLIENT_UPLOAD_FILE_CANCELLED = 90100;
- int CLIENT_UPLOAD_FILE_TIMED_OUT = 90101;
- int CLIENT_UPLOAD_FILE_UNKNOWN = 90102;
- int CLIENT_DISABLED = 90200;
- int ITUNES_PURCHASE_ALREADY_CLAIMED = APPLE_TRANS_ID_ALREADY_CLAIMED;
- int APP_VERSION_NOT_SUPPORTED = GAME_VERSION_NOT_SUPPORTED;
- int CHILD_USER_MISSING = CHILD_PLAYER_MISSING;
- int DISABLED_APP = DISABLED_GAME;
- int APPS_NOT_IN_SAME_COMPANY = GAMES_NOT_IN_SAME_COMPANY;
- int APP_LIMIT_REACHED = GAME_LIMIT_REACHED;
- int APP_PARENT_MISMATCH = GAME_PARENT_MISMATCH;
- int APP_RUNSTATE_DISABLED = GAME_RUNSTATE_DISABLED;
- int APP_VERSION_NO_LONGER_SUPPORTED = APP_VERSION_NOT_SUPPORTED;
- int IMPORT_MISSING_APP_DATA = IMPORT_MISSING_GAME_DATA;
- int INVALID_APP_ID = INVALID_GAME_ID;
- int INVALID_USER_STATISTICS_EVENT_NAME = INVALID_PLAYER_STATISTICS_EVENT_NAME;
- int MISSING_APP_PARENT = MISSING_GAME_PARENT;
- int MISSING_USER_ID = MISSING_PLAYER_ID;
- int MISSING_USER_PARENT = MISSING_PLAYER_PARENT;
- int USER_PARENT_MISMATCH = PLAYER_PARENT_MISMATCH;
- int USER_SESSION_LOGGED_OUT = PLAYER_SESSION_LOGGED_OUT;
-}
diff --git a/src/com/bitheads/braincloud/s2s/StatusCodes.java b/src/com/bitheads/braincloud/s2s/StatusCodes.java
deleted file mode 100644
index 6804c56..0000000
--- a/src/com/bitheads/braincloud/s2s/StatusCodes.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.bitheads.braincloud.client;
-
-/**
- * Created by prestonjennings on 15-09-01.
- */
-public interface StatusCodes {
-
- /**
- * Everything is ok
- */
- int OK = 0;
-
- /**
- * Status code for a client side error
- */
- int CLIENT_NETWORK_ERROR = 900;
-
- /**
- * Status code for an internal server error
- */
- int INTERNAL_SERVER_ERROR = 500;
-
- int BAD_REQUEST = 400;
- int FORBIDDEN = 403;
-}
diff --git a/src/com/bitheads/braincloud/s2s/Brainclouds2s.java b/src/main/java/com/bitheads/brainclouds2s/BrainCloudS2S.java
similarity index 90%
rename from src/com/bitheads/braincloud/s2s/Brainclouds2s.java
rename to src/main/java/com/bitheads/brainclouds2s/BrainCloudS2S.java
index aacbccf..0284b08 100644
--- a/src/com/bitheads/braincloud/s2s/Brainclouds2s.java
+++ b/src/main/java/com/bitheads/brainclouds2s/BrainCloudS2S.java
@@ -1,16 +1,10 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.bitheads.braincloud.s2s;
-
-import com.bitheads.braincloud.client.ReasonCodes;
-import com.bitheads.braincloud.client.StatusCodes;
+package com.bitheads.brainclouds2s;
+
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
+
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Date;
@@ -18,18 +12,23 @@
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
+
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
-/**
- *
- * @author marioc
- */
-public class Brainclouds2s implements Runnable {
+public class BrainCloudS2S implements Runnable {
private static final long NO_PACKET_EXPECTED = -1;
private static final String DEFAULT_S2S_URL = "https://sharedprod.braincloudservers.com/s2sdispatcher";
+
+ private static final int CLIENT_NETWORK_ERROR_TIMEOUT = 90001;
+ private static final int MESSAGE_CONTENT_INVALID_JSON = 40614;
+ private static final int SERVER_SESSION_EXPIRED = 40365;
+ private static final int INVALID_REQUEST = 40001;
+ private static final int BAD_REQUEST = 400;
+ private static final int CLIENT_NETWORK_ERROR = 900;
+
private String _serverUrl;
private String _appId;
private String _serverSecret;
@@ -46,7 +45,7 @@ public class Brainclouds2s implements Runnable {
private long _heartbeatSeconds = 1800; // Default to 30 mins
/**
- * Initialize brainclouds2s context
+ * Initialize BrainCloudS2S context
*
* @param appId Application ID
* @param serverName Server name
@@ -57,7 +56,7 @@ public void init(String appId, String serverName, String serverSecret) {
}
/**
- * Initialize brainclouds2s context
+ * Initialize BrainCloudS2S context
*
* @param appId Application ID
* @param serverName Server name
@@ -84,7 +83,7 @@ public void init(String appId, String serverName, String serverSecret, String se
public void request(JSONObject json, IS2SCallback callback) {
if (!isAuthenticated()) {
- authenticate((Brainclouds2s context, JSONObject response) -> {
+ authenticate((BrainCloudS2S context, JSONObject response) -> {
try {
if (response != null && response.getInt("status") == 200) {
JSONObject data = response.getJSONObject("data");
@@ -100,7 +99,7 @@ public void request(JSONObject json, IS2SCallback callback) {
} catch (JSONException e) {
LogString("Could not authenticate " + e);
if (callback != null) {
- callback.s2sCallback(context, generateError(StatusCodes.BAD_REQUEST, ReasonCodes.MESSAGE_CONTENT_INVALID_JSON, e.getMessage()));
+ callback.s2sCallback(context, generateError(BAD_REQUEST, MESSAGE_CONTENT_INVALID_JSON, e.getMessage()));
}
}
});
@@ -181,7 +180,7 @@ private JSONObject extractResponseAt(int index, JSONObject json) {
JSONObject response = null;
try {
JSONArray messageResponses = json.getJSONArray("messageResponses");
- if (!messageResponses.isEmpty()) {
+ if (messageResponses.length() > 0) {
response = messageResponses.getJSONObject(0);
}
} catch (Exception e) {
@@ -279,7 +278,7 @@ private boolean sendRequest(JSONObject jsonRequest, IS2SCallback callback) {
// non-200 status, retry
if ((connection.getResponseCode() != HttpURLConnection.HTTP_OK && connection.getResponseCode() != HttpURLConnection.HTTP_FORBIDDEN) || responseBody.length() == 0) {
if (callback != null) {
- callback.s2sCallback(this, generateError(connection.getResponseCode(), ReasonCodes.CLIENT_NETWORK_ERROR_TIMEOUT, "Network error"));
+ callback.s2sCallback(this, generateError(connection.getResponseCode(), CLIENT_NETWORK_ERROR_TIMEOUT, "Network error"));
}
return true;
}
@@ -289,7 +288,7 @@ private boolean sendRequest(JSONObject jsonRequest, IS2SCallback callback) {
// check for expired session
if (connection.getResponseCode() == HttpURLConnection.HTTP_FORBIDDEN) {
- if (jsonResponse.getInt("reason_code") == ReasonCodes.SERVER_SESSION_EXPIRED) {
+ if (jsonResponse.getInt("reason_code") == SERVER_SESSION_EXPIRED) {
_sessionId = null;
request(jsonRequest, callback); //re-issue the request to auto login.
return true;
@@ -308,24 +307,24 @@ private boolean sendRequest(JSONObject jsonRequest, IS2SCallback callback) {
} catch (java.net.SocketTimeoutException e) {
LogString("TIMEOUT t: " + new Date().toString());
if (callback != null) {
- callback.s2sCallback(this, generateError(StatusCodes.CLIENT_NETWORK_ERROR, ReasonCodes.CLIENT_NETWORK_ERROR_TIMEOUT, "Network error"));
+ callback.s2sCallback(this, generateError(CLIENT_NETWORK_ERROR, CLIENT_NETWORK_ERROR_TIMEOUT, "Network error"));
}
return true;
} catch (JSONException e) {
LogString("JSON ERROR " + e.getMessage() + " t: " + new Date().toString());
if (callback != null) {
- callback.s2sCallback(this, generateError(StatusCodes.CLIENT_NETWORK_ERROR, ReasonCodes.INVALID_REQUEST, e.getMessage()));
+ callback.s2sCallback(this, generateError(CLIENT_NETWORK_ERROR, INVALID_REQUEST, e.getMessage()));
}
return true;
} catch (IOException e) {
try {
- int status_code = (connection != null) ? connection.getResponseCode() : StatusCodes.CLIENT_NETWORK_ERROR;
+ int status_code = (connection != null) ? connection.getResponseCode() : CLIENT_NETWORK_ERROR;
if (callback != null) {
- callback.s2sCallback(this, generateError(status_code, ReasonCodes.INVALID_REQUEST, e.getMessage()));
+ callback.s2sCallback(this, generateError(status_code, INVALID_REQUEST, e.getMessage()));
}
} catch (IOException e2) {
if (callback != null) {
- callback.s2sCallback(this, generateError(StatusCodes.CLIENT_NETWORK_ERROR, ReasonCodes.INVALID_REQUEST, e2.getMessage()));
+ callback.s2sCallback(this, generateError(CLIENT_NETWORK_ERROR, INVALID_REQUEST, e2.getMessage()));
}
}
}
diff --git a/src/com/bitheads/braincloud/s2s/IS2SCallBackString.java b/src/main/java/com/bitheads/brainclouds2s/IS2SCallBackString.java
similarity index 52%
rename from src/com/bitheads/braincloud/s2s/IS2SCallBackString.java
rename to src/main/java/com/bitheads/brainclouds2s/IS2SCallBackString.java
index 901d756..33b0b12 100644
--- a/src/com/bitheads/braincloud/s2s/IS2SCallBackString.java
+++ b/src/main/java/com/bitheads/brainclouds2s/IS2SCallBackString.java
@@ -1,14 +1,5 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.bitheads.braincloud.s2s;
+package com.bitheads.brainclouds2s;
-/**
- *
- * @author marioc
- */
public interface IS2SCallBackString {
/**
* The serverCallback() method returns server data back to the layer
@@ -18,5 +9,5 @@ public interface IS2SCallBackString {
* @param serviceOperation - requested operation
* @param jsonString - returned data from the server
*/
- void s2sCallback(Brainclouds2s context, String jsonString);
+ void s2sCallback(BrainCloudS2S context, String jsonString);
}
diff --git a/src/com/bitheads/braincloud/s2s/IS2SCallback.java b/src/main/java/com/bitheads/brainclouds2s/IS2SCallback.java
similarity index 78%
rename from src/com/bitheads/braincloud/s2s/IS2SCallback.java
rename to src/main/java/com/bitheads/brainclouds2s/IS2SCallback.java
index 9ced1ac..0ff03e9 100644
--- a/src/com/bitheads/braincloud/s2s/IS2SCallback.java
+++ b/src/main/java/com/bitheads/brainclouds2s/IS2SCallback.java
@@ -1,4 +1,4 @@
-package com.bitheads.braincloud.s2s;
+package com.bitheads.brainclouds2s;
import org.json.JSONObject;
@@ -11,7 +11,7 @@ public interface IS2SCallback {
* @param serviceOperation - requested operation
* @param jsonData - returned data from the server
*/
- void s2sCallback(Brainclouds2s context, JSONObject jsonData);
+ void s2sCallback(BrainCloudS2S context, JSONObject jsonData);
}
diff --git a/src/test/java/com/bitheads/brainclouds2s/BrainCloudS2STest.java b/src/test/java/com/bitheads/brainclouds2s/BrainCloudS2STest.java
new file mode 100644
index 0000000..51e44da
--- /dev/null
+++ b/src/test/java/com/bitheads/brainclouds2s/BrainCloudS2STest.java
@@ -0,0 +1,170 @@
+package com.bitheads.brainclouds2s;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.bitheads.brainclouds2s.BrainCloudS2S;
+
+import org.json.JSONArray;
+import org.json.JSONObject;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class BrainCloudS2STest {
+
+ static protected String m_serverUrl = "";
+ static protected String m_appId = "";
+ static protected String m_serverSecret = "";
+ static protected String m_serverName = "";
+
+ public BrainCloudS2STest() {
+ }
+
+ private static BrainCloudS2S _s2sClient;
+
+ ///
+ /// Routine loads up brainCloud configuration info from "${PROJECT_ROOT}/ids.txt"
+ /// (hopefully)
+ /// in a platform agnostic way.
+ ///
+ static private void loadIds() {
+ if (m_serverUrl.length() > 0) {
+ return;
+ }
+
+ File idsFile = new File("ids.txt");
+ try {
+ System.out.println("Looking for ids.txt file in " + idsFile.getCanonicalPath());
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ if (idsFile.exists()) {
+ System.out.println("Found ids.txt file");
+ }
+
+ List lines = new ArrayList<>();
+ BufferedReader reader = null;
+
+ try {
+ reader = new BufferedReader(new FileReader(idsFile));
+ String text;
+ while ((text = reader.readLine()) != null) {
+ lines.add(text);
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ try {
+ if (reader != null) {
+ reader.close();
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ for (String line : lines) {
+ String[] split = line.split("=");
+ switch (split[0]) {
+ case "s2sUrl":
+ m_serverUrl = split[1];
+ break;
+ case "appId":
+ m_appId = split[1];
+ break;
+ case "serverName":
+ m_serverName = split[1];
+ break;
+ case "serverSecret":
+ m_serverSecret = split[1];
+ break;
+ }
+ }
+ }
+
+ @BeforeClass
+ public static void setUpClass() {
+ loadIds();
+ }
+
+ @AfterClass
+ public static void tearDownClass() {
+ }
+
+ @Before
+ public void setUp() {
+
+ System.out.println("setUp()");
+
+ _s2sClient = new BrainCloudS2S();
+ _s2sClient.init(m_appId, m_serverName, m_serverSecret, m_serverUrl);
+ _s2sClient.setLogEnabled(true);
+
+ if (!_s2sClient.isIsInitialized()) {
+ fail("Initialization Failed");
+ _s2sClient = null;
+ }
+ }
+
+ @After
+ public void tearDown() {
+
+ System.out.println("tearDown()");
+
+ if (_s2sClient != null) {
+ _s2sClient.disconnect();
+ _s2sClient = null;
+ }
+ }
+
+ /**
+ * Test of globalEntity service, of Brainclouds2s request.
+ */
+ @Test
+ public void testGetList() {
+
+ System.out.println("testGetList()");
+
+ System.out.println("testGetList");
+ JSONObject json = new JSONObject();
+ json.put("service", "globalEntity");
+ json.put("operation", "GET_LIST");
+
+ JSONObject orderBy = new JSONObject();
+ JSONObject where = new JSONObject();
+ JSONObject params = new JSONObject();
+ where.put("entityType", "address");
+ params.put("where", where);
+ params.put("orderBy", orderBy);
+ params.put("maxReturn", 5);
+ json.put("data", params);
+
+ _s2sClient.request(json, (BrainCloudS2S context, JSONObject jsonData) -> {
+ if (context != _s2sClient) {
+ fail("wrong context returned");
+ }
+ if (jsonData.getInt("status") != 200) {
+ fail("Error returned");
+ }
+ if (!jsonData.has("data")) {
+ fail("Missing data in return");
+ }
+ if (!jsonData.getJSONObject("data").has("entityList")) {
+ fail("Missing entityList in return");
+ }
+ JSONArray list = jsonData.getJSONObject("data").getJSONArray("entityList");
+
+ System.out.println(jsonData.toString());
+ });
+ }
+}
diff --git a/test/com/bitheads/braincloud/s2s/Brainclouds2sClientTest.java b/test/com/bitheads/braincloud/s2s/Brainclouds2sClientTest.java
deleted file mode 100644
index d1aa93b..0000000
--- a/test/com/bitheads/braincloud/s2s/Brainclouds2sClientTest.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.bitheads.braincloud.s2s;
-
-import static com.bitheads.braincloud.s2s.Brainclouds2sSetupTest.m_serverUrl;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import org.json.JSONArray;
-import org.json.JSONObject;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- *
- * @author marioc
- */
-public class Brainclouds2sClientTest {
-
- static protected String m_serverUrl = "";
- static protected String m_appId = "";
- static protected String m_serverSecret = "";
- static protected String m_serverName = "";
-
- public Brainclouds2sClientTest() {
- }
-
- private static Brainclouds2s _s2sClient;
-
- ///
- /// Routine loads up brainCloud configuration info from "tests/ids.txt" (hopefully)
- /// in a platform agnostic way.
- ///
- static private void LoadIds() {
- if (m_serverUrl.length() > 0) {
- return;
- }
-
- File idsFile = new File("ids.txt");
- try {
- System.out.println("Looking for ids.txt file in " + idsFile.getCanonicalPath());
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- if (idsFile.exists()) {
- System.out.println("Found ids.txt file");
- }
-
- List lines = new ArrayList<>();
- BufferedReader reader = null;
-
- try {
- reader = new BufferedReader(new FileReader(idsFile));
- String text;
- while ((text = reader.readLine()) != null) {
- lines.add(text);
- }
- } catch (IOException e) {
- e.printStackTrace();
- } finally {
- try {
- if (reader != null) {
- reader.close();
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- for (String line : lines) {
- String[] split = line.split("=");
- switch (split[0]) {
- case "serverUrl":
- m_serverUrl = split[1];
- break;
- case "appId":
- m_appId = split[1];
- break;
- case "serverName":
- m_serverName = split[1];
- break;
- case "serverSecret":
- m_serverSecret = split[1];
- break;
- }
- }
- }
-
- @BeforeClass
- public static void setUpClass() {
-
- LoadIds();
- _s2sClient = new Brainclouds2s();
- _s2sClient.init(m_appId, m_serverName, m_serverSecret);
- _s2sClient.setLogEnabled(true);
-
- if (!_s2sClient.isIsInitialized()) {
- fail("Initialization Failed");
- }
- }
-
- @AfterClass
- public static void tearDownClass() {
- _s2sClient.disconnect();
- }
-
- @Before
- public void setUp() {
-
- }
-
- @After
- public void tearDown() {
- }
-
- /**
- * Test of globalEntity service, of Brainclouds2s request.
- */
- @Test
- public void testGetList() {
- System.out.println("testGetList");
- JSONObject json = new JSONObject();
- json.put("service", "globalEntity");
- json.put("operation", "GET_LIST");
-
- JSONObject orderBy = new JSONObject();
- JSONObject where = new JSONObject();
- JSONObject params = new JSONObject();
- where.put("entityType", "address");
- params.put("where", where);
- params.put("orderBy", orderBy);
- params.put("maxReturn", 5);
- json.put("data", params);
-
- _s2sClient.request(json, (Brainclouds2s context, JSONObject jsonData) -> {
- if (context != _s2sClient) {
- fail("wrong context returned");
- }
- if (jsonData.getInt("status") != 200) {
- fail("Error returned");
- }
- if (!jsonData.has("data")) {
- fail("Missing data in return");
- }
- if (!jsonData.getJSONObject("data").has("entityList")) {
- fail("Missing entityList in return");
- }
- JSONArray list = jsonData.getJSONObject("data").getJSONArray("entityList");
-
- System.out.println(jsonData.toString());
- });
- }
-
- /**
- * Test of globalApp service, of Brainclouds2s request.
- */
- @Test
- public void testReadProperties() {
- System.out.println("testReadProperties");
- JSONObject json = new JSONObject();
- json.put("service", "globalApp");
- json.put("operation", "READ_PROPERTIES");
-
- _s2sClient.request(json, (Brainclouds2s context, JSONObject jsonData) -> {
- if (context != _s2sClient) {
- fail("wrong context returned");
- }
- if (jsonData.getInt("status") != 200) {
- fail("Error returned");
- }
-
- if (jsonData.has("Status")) {
- JSONObject Sample = jsonData.getJSONObject("Sample");
- if (Sample.has("value")) {
- if (!"DoNotChangeThisValue".equals(Sample.getString("value"))) {
- fail("Unexpected READ_PROPERTIES response " + Sample.toString());
- }
- }
- }
- System.out.println(jsonData.toString());
- });
- }
-
- /**
- * Test of globalApp service, of Brainclouds2s request.
- */
- @Test
- public void testReadPropertiesString() {
- System.out.println("testReadProperties");
- String json = "{\"service\":\"globalApp\",\"operation\":\"READ_PROPERTIES\"}";
- _s2sClient.request(json, (Brainclouds2s context, String jsonString) -> {
- if (context != _s2sClient) {
- fail("wrong context returned");
- }
- if (jsonString.length() == 0) {
- fail("Error returned");
- }
- JSONObject jsonData = new JSONObject(jsonString);
- if (jsonData.has("Status")) {
- JSONObject Sample = jsonData.getJSONObject("Sample");
- if (Sample.has("value")) {
- if (!"DoNotChangeThisValue".equals(Sample.getString("value"))) {
- fail("Unexpected READ_PROPERTIES response " + Sample.toString());
- }
- }
- }
- System.out.println(jsonData.toString());
- });
- }
-
- /**
- * Test of script service, of Brainclouds2s request.
- */
- @Test
- public void testGetScheduleCloudScripts() {
- System.out.println("testGetScheduleCloudScripts");
- JSONObject json = new JSONObject();
- json.put("service", "script");
- json.put("operation", "GET_SCHEDULED_CLOUD_SCRIPTS");
-
- JSONObject params = new JSONObject();
- params.put("startDateUTC", 1508295320000l);
- json.put("data", params);
-
- _s2sClient.request(json, (Brainclouds2s context, JSONObject jsonData) -> {
- if (context != _s2sClient) {
- fail("wrong context returned");
- }
- if (jsonData.getInt("status") != 200) {
- fail("Error returned");
- }
- System.out.println(jsonData.toString());
- });
- }
-
- /**
- * Test of event service, of Brainclouds2s request.
- */
- @Test
- public void testSendEvent() {
- System.out.println("testSendEvent");
- JSONObject json = new JSONObject();
- json.put("service", "event");
- json.put("operation", "SEND");
-
- JSONObject eventData = new JSONObject();
- JSONObject data = new JSONObject();
- eventData.put("someMapAttribute", "somValue");
- data.put("toId", "player1");
- data.put("eventType", "type1");
- data.put("eventData", eventData);
- data.put("recordLocally", false);
- json.put("data", data);
-
- _s2sClient.request(json, (Brainclouds2s context, JSONObject jsonData) -> {
- if (context != _s2sClient) {
- fail("wrong context returned");
- }
- if (jsonData.getInt("status") != 200) {
- fail("Error returned");
- }
- System.out.println(jsonData.toString());
- });
- }
-
- /**
- * Test of disconnect, of Brainclouds2s request.
- */
- @Test
- public void testDisconnect() {
- System.out.println("testDisconnect");
- JSONObject json = new JSONObject();
- json.put("service", "globalApp");
- json.put("operation", "READ_PROPERTIES");
-
- _s2sClient.disconnect();
-
- _s2sClient.request(json, (Brainclouds2s context, JSONObject jsonData) -> {
- if (context != _s2sClient) {
- fail("wrong context returned");
- }
- if (200 != jsonData.getInt("status")) {
- fail("Error returned");
- }
- System.out.println(jsonData.toString());
- });
- }
-}
diff --git a/test/com/bitheads/braincloud/s2s/Brainclouds2sSetupTest.java b/test/com/bitheads/braincloud/s2s/Brainclouds2sSetupTest.java
deleted file mode 100644
index 8ab14f7..0000000
--- a/test/com/bitheads/braincloud/s2s/Brainclouds2sSetupTest.java
+++ /dev/null
@@ -1,339 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.bitheads.braincloud.s2s;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.List;
-import org.json.JSONObject;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- *
- * @author marioc
- */
-public class Brainclouds2sSetupTest {
-
- static protected String m_serverUrl = "";
- static protected String m_appId = "";
- static protected String m_serverSecret = "";
- static protected String m_serverName = "";
-
- public Brainclouds2sSetupTest() {
- }
-
- class Callback implements IS2SCallback {
-
- private int _expectStatus = 200;
- Brainclouds2s _instance = null;
- public Callback(int expectStatus,Brainclouds2s instance) {
- _expectStatus = expectStatus;
- _instance = instance;
- }
-
- @Override
- public void s2sCallback(Brainclouds2s context, JSONObject jsonData) {
- if (jsonData != null && jsonData.getInt("status") == _expectStatus ) {
- System.out.println("Received " + jsonData.toString());
- } else if (jsonData == null) {
- System.out.println("Request failed null respose");
- fail("Request failed null respose");
- } else {
- System.out.println("Request failed unexpected status, wanted " + _expectStatus + " received :" + jsonData.toString());
- fail("Request failed unexpected status, wanted " + _expectStatus + " received :" + jsonData.toString());
- }
- _instance.disconnect();
- }
-
- }
-
- ///
- /// Routine loads up brainCloud configuration info from "tests/ids.txt" (hopefully)
- /// in a platform agnostic way.
- ///
- private void LoadIds() {
- if (m_serverUrl.length() > 0) return;
-
- File idsFile = new File("ids.txt");
- try {
- System.out.println("Looking for ids.txt file in " + idsFile.getCanonicalPath());
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- if (idsFile.exists()) System.out.println("Found ids.txt file");
-
- List lines = new ArrayList<>();
- BufferedReader reader = null;
-
- try {
- reader = new BufferedReader(new FileReader(idsFile));
- String text;
- while ((text = reader.readLine()) != null) {
- lines.add(text);
- }
- } catch (IOException e) {
- e.printStackTrace();
- } finally {
- try {
- if (reader != null) {
- reader.close();
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- for (String line : lines) {
- String[] split = line.split("=");
- switch (split[0]) {
- case "serverUrl":
- m_serverUrl = split[1];
- break;
- case "appId":
- m_appId = split[1];
- break;
- case "serverName":
- m_serverName = split[1];
- break;
- case "serverSecret":
- m_serverSecret = split[1];
- break;
- }
- }
-}
-
- @BeforeClass
- public static void setUpClass() {
-
- }
-
- @AfterClass
- public static void tearDownClass() {
- }
-
- @Before
- public void setUp() {
- LoadIds();
- }
-
- @After
- public void tearDown() {
- }
-
- /**
- * Test of initialize method, of class Brainclouds2s.
- */
- @Test
- public void testInitialize_3args() {
- System.out.println("testInitialize_3args");
- String appId = m_appId;
- String serverName = m_serverName;
- String serverSecret = m_serverSecret;
- Brainclouds2s instance = new Brainclouds2s();
- instance.init(appId, serverName, serverSecret);
-
- if (!instance.isIsInitialized()) {
- fail("Initialization Failed");
- }
-
- }
-
- /**
- * Test of initialize method, of class Brainclouds2s.
- */
- @Test
- public void testInitialize_4args() {
- System.out.println("testInitialize_4args");
- String appId = m_appId;
- String serverName = m_serverName;
- String serverSecret = m_serverSecret;
- String serverUrl = "https://sharedprod.braincloudservers.com/s2sdispatcher";
- Brainclouds2s instance = new Brainclouds2s();
- instance.init(appId, serverName, serverSecret, serverUrl);
- if (!instance.isIsInitialized()) {
- fail("Initialization with url Failed.");
- }
- }
-
- /**
- * Test of getLoggingEnabled method, of class Brainclouds2s.
- */
- @Test
- public void testGetLoggingEnabled() {
- System.out.println("testGetLoggingEnabled");
- Brainclouds2s instance = new Brainclouds2s();
- boolean expResult = false;
- boolean result = instance.getLogEnabled();
- assertEquals(expResult, result);
- if (result) {
- fail("Logging enable at initialization.");
- }
- }
-
- /**
- * Test of enableLogging method, of class Brainclouds2s.
- */
- @Test
- public void testEnableLogging() {
- System.out.println("testEnableLogging");
- boolean isEnabled = true;
- Brainclouds2s instance = new Brainclouds2s();
- instance.setLogEnabled(true);
- if (!instance.getLogEnabled()) {
- fail("Could not enable logging.");
- }
- instance.setLogEnabled(false);
- if (instance.getLogEnabled()) {
- fail("Could not disable logging.");
- }
- }
-
- /**
- * Test of request method, of class Brainclouds2s.
- */
- @Test
- public void testRequest() {
- System.out.println("testRequest");
- String appId = m_appId;
- String serverName = m_serverName;
- String serverSecret = m_serverSecret;
- Brainclouds2s instance = new Brainclouds2s();
- instance.init(appId, serverName, serverSecret);
-
- JSONObject json = new JSONObject();
- json.put("service", "globalEntity");
- json.put("operation", "GET_LIST");
-
- JSONObject orderBy = new JSONObject();
- JSONObject where = new JSONObject();
- JSONObject params = new JSONObject();
- where.put("entityType", "address");
- params.put("where", where);
- params.put("orderBy", orderBy);
- params.put("maxReturn", 5);
- json.put("data",params);
- IS2SCallback callback = new Callback(200,instance);
- instance.request(json, callback);
- }
- /**
- * Test of request method while logging, of class Brainclouds2s.
- */
- @Test
- public void testRequestWithLog() {
- System.out.println("testRequestWithLog");
- String appId = m_appId;
- String serverName = m_serverName;
- String serverSecret = m_serverSecret;
- Brainclouds2s instance = new Brainclouds2s();
- instance.init(appId, serverName, serverSecret);
- instance.setLogEnabled(true);
- JSONObject json = new JSONObject();
- json.put("service", "globalEntity");
- json.put("operation", "GET_LIST");
-
- JSONObject orderBy = new JSONObject();
- JSONObject where = new JSONObject();
- JSONObject params = new JSONObject();
- where.put("entityType", "address");
- params.put("where", where);
- params.put("orderBy", orderBy);
- params.put("maxReturn", 5);
- json.put("data",params);
- IS2SCallback callback = new Callback(200,instance);
- instance.request(json, callback);
- }
-
- /**
- * Test of request method with invalid secret, of class Brainclouds2s.
- */
- @Test
- public void testRequestInvalidSecret() {
- System.out.println("testRequestInvalidSecret");
- String appId = m_appId;
- String serverName = m_serverName;
- String serverSecret = "aaaaaaaa-bbbb-111111111-222222222222";
- Brainclouds2s instance = new Brainclouds2s();
- instance.init(appId, serverName, serverSecret);
-// instance.setLogEnabled(true);
- JSONObject json = new JSONObject();
- json.put("service", "globalEntity");
- json.put("operation", "GET_LIST");
-
- JSONObject orderBy = new JSONObject();
- JSONObject where = new JSONObject();
- JSONObject params = new JSONObject();
- where.put("entityType", "address");
- params.put("where", where);
- params.put("orderBy", orderBy);
- params.put("maxReturn", 5);
- json.put("data",params);
- IS2SCallback callback = new Callback(400,instance);
- instance.request(json, callback);
- }
- /**
- * Test of request method with invalid secret, of class Brainclouds2s.
- */
- @Test
- public void testRequestInvalidAppId() {
- System.out.println("testRequestInvalidSappId");
- String appId = "";
- String serverName = m_serverName;
- String serverSecret = "aaaaaaaa-bbbb-111111111-222222222222";
- Brainclouds2s instance = new Brainclouds2s();
- instance.init(appId, serverName, serverSecret);
- JSONObject json = new JSONObject();
- json.put("service", "globalEntity");
- json.put("operation", "GET_LIST");
-
- JSONObject orderBy = new JSONObject();
- JSONObject where = new JSONObject();
- JSONObject params = new JSONObject();
- where.put("entityType", "address");
- params.put("where", where);
- params.put("orderBy", orderBy);
- params.put("maxReturn", 5);
- json.put("data",params);
- IS2SCallback callback = new Callback(403,instance);
- instance.request(json, callback);
- }
- /**
- * Test of runCallbacks method, of class Brainclouds2s.
- */
- @Test
- public void testExpiredSession() throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
- System.out.println("testExpiredSession");
- String appId = m_appId;
- String serverName = m_serverName;
- String serverSecret = m_serverSecret;
- String expiredSessionId = "m336o7k9ekd7l71kqhtb1ce8ul";
-
- Field sessionId = Brainclouds2s.class.getDeclaredField("_sessionId");
- sessionId.setAccessible(true);
- Brainclouds2s instance = new Brainclouds2s();
- instance.init(appId, serverName, serverSecret);
- instance.setLogEnabled(true);
- sessionId.set(instance,expiredSessionId);
- JSONObject json = new JSONObject();
- json.put("service", "heartbeat");
- json.put("operation", "HEARTBEAT");
-
- IS2SCallback callback = new Callback(200,instance);
- System.out.println("testExpiredSession: initial sessionId:"+expiredSessionId);
- instance.request(json, callback);
-
- }
-}
diff --git a/version.txt b/version.txt
deleted file mode 100644
index 902b2c9..0000000
--- a/version.txt
+++ /dev/null
@@ -1 +0,0 @@
-3.11
\ No newline at end of file