Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Port over from sf.net

  • Loading branch information...
commit 7166f5c3df6e12971e0e73973aef0f0c0e2257a5 1 parent d710926
@aalmiray authored
View
10 .gitignore
@@ -0,0 +1,10 @@
+.gradle
+target
+velocity.log
+cobertura.ser
+build.properties
+.classpath
+.project
+.settings
+build.sh
+build
View
48 build.gradle
@@ -0,0 +1,48 @@
+apply plugin: 'groovy'
+apply plugin: 'maven'
+// apply plugin: 'code-quality'
+
+sourceCompatibility = '1.3'
+targetCompatibility = '1.1'
+archivesBaseName = 'json-lib'
+group = 'net.sf.json-lib'
+version = '2.4'
+
+configurations {
+ jdk15 { extendsFrom compile }
+}
+
+repositories {
+ mavenCentral()
+}
+
+dependencies {
+ groovy 'org.codehaus.groovy:groovy-all:1.7.5'
+ compile 'junit:junit:3.8.2',
+ 'commons-beanutils:commons-beanutils:1.8.0',
+ 'commons-collections:commons-collections:3.2.1',
+ 'commons-lang:commons-lang:2.5',
+ compile('commons-logging:commons-logging:1.1.1') {
+ exclude(module: 'log4j')
+ exclude(module: 'logkit')
+ exclude(module: 'avalon-framework')
+ exclude(module: 'servlet-api')
+ }
+ // the following are optional
+ compile 'xom:xom:1.1',
+ 'oro:oro:2.0.8',
+ 'net.sf.ezmorph:ezmorph:1.0.6',
+ 'org.codehaus.groovy:groovy-all:1.7.5'
+ runtime 'log4j:log4j:1.2.14'
+ testCompile 'xmlunit:xmlunit:1.0',
+ 'commons-httpclient:commons-httpclient:3.1'
+}
+
+sourceSets {
+ jdk15 {
+ compileClasspath = sourceSets.main.classes + configurations.jdk15
+ java.srcDirs = ['src/main/jdk15']
+ groovy.srcDirs = []
+ classesDir = "$buildDir/classes/jdk15" as File
+ }
+}
View
33 build.xml
@@ -105,7 +105,7 @@
</groovyc>
</target>
- <target name="test" depends="test.jdk3,test.groovy,test.jruby" description="Run JDK13, Groovy &amp; JRuby test cases" />
+ <target name="test" depends="test.jdk3,test.groovy" description="Run JDK13 &amp; Groovy test cases" />
<target name="test.jdk3" depends="junit-present, compile-tests" if="junit.present" description="Run the test cases (jdk1.3)">
<mkdir dir="${maven.test.reports}" />
@@ -156,7 +156,6 @@
</batchtest>
</junit>
<antcall target="test.groovy"/>
- <antcall target="test.jruby"/>
</target>
<target name="test.groovy" depends="junit-present, compile-tests.groovy" if="junit.present" description="Run the test cases (Groovy)">
@@ -180,36 +179,6 @@
</junit>
</target>
- <target name="test.jruby" depends="run.jruby,alert.jruby" description="Run the test cases (JRuby)"/>
- <target name="check-jruby">
- <condition property="jruby.available">
- <isset property="jruby.home" />
- </condition>
- </target>
-
- <target name="run.jruby" depends="check-jruby,compile" if="jruby.available">
- <copy todir="${maven.build.output}">
- <fileset dir="src/main/jruby" />
- </copy>
- <java classname="org.jruby.Main" fork="true" maxmemory="256M" failonerror="true">
- <classpath>
- <path refid="build.classpath" />
- <path refid="test.classpath" />
- <path refid="runtime.classpath" />
- <pathelement location="${maven.build.output}" />
- <pathelement location="${basedir}/src/main/jruby/" />
- <pathelement location="${basedir}/src/test/jruby/net/sf/json/jruby/" />
- </classpath>
- <sysproperty key="jruby.home" value="${jruby.home}" />
- <arg value="${basedir}/src/test/jruby/net/sf/json/jruby/testsuite.rb" />
- </java>
- </target>
- <target name="alert.jruby" depends="check-jruby" unless="jruby.available">
- <echo>================================= WARNING ================================</echo>
- <echo> jruby.home ($JRUBY_HOME) is not configured in your local settings.</echo>
- <echo>==========================================================================</echo>
- </target>
-
<target name="test-junit-present">
<available classname="junit.framework.Test" property="junit.present" />
</target>
View
13 pom.xml
@@ -7,7 +7,7 @@
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<packaging>jar</packaging>
- <version>2.3</version>
+ <version>2.4</version>
<name>json-lib</name>
<url>http://json-lib.sourceforge.net</url>
@@ -177,7 +177,7 @@
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
- <version>2.4</version>
+ <version>2.5</version>
<scope>compile</scope>
</dependency>
<dependency>
@@ -234,14 +234,7 @@
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
- <version>1.5.7</version>
- <scope>compile</scope>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.jruby</groupId>
- <artifactId>jruby</artifactId>
- <version>1.1</version>
+ <version>1.7.5</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
View
25 src/main/jruby/net/sf/json/jsonarray.rb
@@ -1,25 +0,0 @@
-#
-# Copyright 2002-2007 the original author or authors.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# @author Andres Almiray <aalmiray@users.sourceforge.net>
-#
-
-include_class 'net.sf.json.JSONArray'
-
-class JSONArray
- def empty?
- return isEmpty()
- end
-end
View
41 src/main/jruby/net/sf/json/jsonobject.rb
@@ -1,41 +0,0 @@
-#
-# Copyright 2002-2007 the original author or authors.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# @author Andres Almiray <aalmiray@users.sourceforge.net>
-#
-
-include_class 'net.sf.json.JSONObject'
-
-class JSONObject
- def empty?
- return isEmpty()
- end
-
- def <<(arg)
- if( !arg.nil? )
- if( (arg.instance_of? Array) && (arg.length > 1) )
- key = arg.shift
- if( arg.length == 1 )
- element( key, arg[0] )
- else
- element( key, arg )
- end
- elsif( (arg.instance_of? Hash) && !(arg.empty?) )
- putAll( arg )
- end
- end
- return self
- end
-end
View
2  src/test/java/net/sf/json/TestJSONSerializer.java
@@ -221,7 +221,7 @@ public void testToJSON_String_array() {
public void testToJSON_String_invalid() {
try{
JSONSerializer.toJSON( "garbage" );
- fail( "Should have throwed a JSONException" );
+ fail( "Should have thrown a JSONException" );
}catch( JSONException expected ){
// ok
}
View
10 src/test/jruby/net/sf/json/jruby/tc_jsonarray.rb
@@ -1,10 +0,0 @@
-require 'test/unit'
-require 'java'
-require 'net/sf/json/jsonarray'
-
-class TC_JsonArray < Test::Unit::TestCase
- def test_empty?
- json = JSONArray.new
- assert json.empty?
- end
-end
View
35 src/test/jruby/net/sf/json/jruby/tc_jsonobject.rb
@@ -1,35 +0,0 @@
-require 'test/unit'
-require 'java'
-require 'net/sf/json/jsonobject'
-
-class TC_JsonObject < Test::Unit::TestCase
- def test_empty?
- json = JSONObject.new
- assert json.empty?
- end
-
- def test_simple_values
- json = JSONObject.new
- json.element("string","json").element("bool",true)
- json["integer"] = 1
- assert_equal "json", json["string"]
- assert_equal true, json["bool"]
- assert_equal 1, json["integer"]
- end
-
- def test_leftshift_array
- json = JSONObject.new
- json << ["key","value"]
- assert !json.empty?
- assert_equal "value", json["key"]
- end
-
- def test_leftshift_hash
- json = JSONObject.new
- json << {"key1" => "value1", "key2" => "value2" }
- assert !json.empty?
- assert_equal 2, json.size()
- assert_equal "value1", json["key1"]
- assert_equal "value2", json["key2"]
- end
-end
View
3  src/test/jruby/net/sf/json/jruby/testsuite.rb
@@ -1,3 +0,0 @@
-require 'test/unit/testsuite'
-require 'tc_jsonobject'
-require 'tc_jsonarray'
Please sign in to comment.
Something went wrong with that request. Please try again.