Compare commits

...

12 Commits

Author SHA1 Message Date
openeuler-ci-bot
2f73bf6ad2 !6 Package init
Merge pull request !6 from yeah_wang/apple
2019-12-10 11:39:50 +08:00
yeah_wang
ffcf290456 Package init 2019-12-10 11:34:36 +08:00
openeuler-ci-bot
d86ca6329b !4 add apache-commons-lang
Merge pull request !4 from yeah_wang/apple
2019-12-09 21:00:04 +08:00
yeah_wang
3626f3d694 update remove-2-test-fix-compile-with-bep-java.patch. 2019-12-09 20:53:04 +08:00
yeah_wang
021a72df12 update apache-commons-lang.spec. 2019-12-09 20:50:56 +08:00
yeah_wang
912c315bff 删除文件 README.md 2019-12-09 20:45:24 +08:00
yeah_wang
ce0d28b081 删除文件 README.en.md 2019-12-09 20:45:17 +08:00
openeuler-ci-bot
c4cc9e0b64 !3 add apache-commos-lang
Merge pull request !3 from yeah_wang/apple
2019-12-09 20:25:40 +08:00
yeah_wang
18ae5485a7 update remove-2-test-fix-compile-with-bep-java.patch. 2019-12-09 20:22:55 +08:00
openeuler-ci-bot
e2c1324de1 !2 add apache-commons-lang
Merge pull request !2 from yeah_wang/apple
2019-12-09 17:12:50 +08:00
yeah_wang
4aa587716b update remove-2-test-fix-compile-with-bep-java.patch. 2019-12-09 17:06:17 +08:00
yeah_wang
b52be7e9fd add lang 2019-12-09 17:04:13 +08:00
4 changed files with 578 additions and 81 deletions

View File

@ -1,36 +0,0 @@
# apache-commons-lang
#### Description
{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**}
#### Software Architecture
Software architecture description
#### Installation
1. xxxx
2. xxxx
3. xxxx
#### Instructions
1. xxxx
2. xxxx
3. xxxx
#### Contribution
1. Fork the repository
2. Create Feat_xxx branch
3. Commit your code
4. Create Pull Request
#### Gitee Feature
1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
4. The most valuable open source project [GVP](https://gitee.com/gvp)
5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

View File

@ -1,39 +0,0 @@
# apache-commons-lang
#### 介绍
{**以下是码云平台说明,您可以替换此简介**
码云是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN。专为开发者提供稳定、高效、安全的云端软件开发协作平台
无论是个人、团队、或是企业,都能够用码云实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)}
#### 软件架构
软件架构说明
#### 安装教程
1. xxxx
2. xxxx
3. xxxx
#### 使用说明
1. xxxx
2. xxxx
3. xxxx
#### 参与贡献
1. Fork 本仓库
2. 新建 Feat_xxx 分支
3. 提交代码
4. 新建 Pull Request
#### 码云特技
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com)
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目
4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目
5. 码云官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

View File

@ -3,22 +3,20 @@ Version: 2.6
Release: 23 Release: 23
Summary: Provides a host of helper utilities for the java.lang API Summary: Provides a host of helper utilities for the java.lang API
License: ASL 2.0 License: ASL 2.0
Group: Development/Libraries
URL: http://commons.apache.org/lang URL: http://commons.apache.org/lang
Source0: http://archive.apache.org/dist/commons/lang/source/commons-lang-2.6-src.tar.gz Source0: http://archive.apache.org/dist/commons/lang/source/commons-lang-2.6-src.tar.gz
Patch0000: 0002-Fix-FastDateFormat-for-Java-7-behaviour.patch Patch0000: 0002-Fix-FastDateFormat-for-Java-7-behaviour.patch
Patch9000: remove-2-test-fix-compile-with-bep-java.patch Patch9000: remove-2-test-fix-compile-with-bep-java.patch
BuildArch: noarch
BuildArch: noarch BuildRequires: maven-local apache-commons-parent maven-surefire-provider-junit
BuildRequires: maven-local apache-commons-parent maven-surefire-provider-junit
%description %description
The standard Java libraries fail to provide enough methods for manipulation of The standard Java libraries fail to provide enough methods for manipulation of
its core classes. Apache Commons Lang provides these extra methods. its core classes. Apache Commons Lang provides these extra methods.
%package help %package help
Summary: API documentation for apache-commons-lang Summary: API documentation for apache-commons-lang
Provides: %{name}-javadoc = %{version}-%{release}
Obsoletes: %{name}-javadoc < %{version}-%{release}
%description help %description help
The help for apache-commons-lang to use. The help for apache-commons-lang to use.
@ -26,9 +24,12 @@ The help for apache-commons-lang to use.
%prep %prep
%autosetup -n commons-lang-2.6-src -p1 %autosetup -n commons-lang-2.6-src -p1
sed -i 's/\r//' *.txt *.html
%pom_add_plugin org.apache.maven.plugins:maven-javadoc-plugin . " %pom_add_plugin org.apache.maven.plugins:maven-javadoc-plugin . "
<configuration><source>1.3</source></configuration>" <configuration><source>1.3</source></configuration>"
%mvn_file : apache-commons-lang commons-lang %mvn_file : apache-commons-lang commons-lang
%mvn_alias : org.apache.commons: lang:lang %mvn_alias : org.apache.commons: lang:lang
%mvn_config buildSettings/compilerSource 1.3 %mvn_config buildSettings/compilerSource 1.3

View File

@ -0,0 +1,571 @@
diff -Nur commons-lang-2.6-src-bak/src/test/java/org/apache/commons/lang/math/RandomUtilsTest.java commons-lang-2.6-src/src/test/java/org/apache/commons/lang/math/RandomUtilsTest.java
--- commons-lang-2.6-src-bak/src/test/java/org/apache/commons/lang/math/RandomUtilsTest.java 2019-12-04 17:52:01.857276428 +0800
+++ commons-lang-2.6-src/src/test/java/org/apache/commons/lang/math/RandomUtilsTest.java 1970-01-01 08:00:00.000000000 +0800
@@ -1,342 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-package org.apache.commons.lang.math;
-
-import java.util.Random;
-
-import junit.framework.TestCase;
-
-/**
- * Test cases for the {@link RandomUtils} class.
- *
- * @author <a href="mailto:phil@steitz.com">Phil Steitz</a>
- * @version $Revision: 912374 $ $Date: 2010-02-21 17:20:57 +0000 (Sun, 21 Feb 2010) $
- */
-
-public final class RandomUtilsTest extends TestCase {
-
- public RandomUtilsTest(String name) {
- super(name);
- }
-
- /** test distribution of nextInt() */
- public void testNextInt() {
- tstNextInt(null);
-
- assertTrue (RandomUtils.nextInt() >= 0);
- }
-
- /** test distribution of nextInt(Random) */
- public void testNextInt2() {
- Random rnd = new Random();
- rnd.setSeed(System.currentTimeMillis());
- tstNextInt(rnd);
- }
-
- /** test distribution of JVMRandom.nextInt() */
- public void testJvmRandomNextInt() {
- tstNextInt(RandomUtils.JVM_RANDOM);
- }
-
-
- /**
- * Generate 1000 values for nextInt(bound) and compare
- * the observed frequency counts to expected counts using
- * a chi-square test.
- * @param rnd Random to use if not null
- */
- private void tstNextInt(Random rnd) {
- int bound = 0;
- int result = 0;
- // test boundary condition: n = Integer.MAX_VALUE;
- bound = Integer.MAX_VALUE;
- if (rnd == null) {
- result = RandomUtils.nextInt(bound);
- } else {
- result = RandomUtils.nextInt(rnd,bound);
- }
- assertTrue("result less than bound",result < bound);
- assertTrue("result non-negative",result >= 0);
-
- // test uniformity -- use Chi-Square test at .01 level
- bound = 4;
- int[] expected = new int[] {250,250,250,250};
- int[] observed = new int[] {0,0,0,0};
- for (int i = 0; i < 1000; i ++) {
- if (rnd == null) {
- result = RandomUtils.nextInt(bound);
- } else {
- result = RandomUtils.nextInt(rnd,bound);
- }
- assertTrue(result < bound);
- assertTrue(result >= 0);
- observed[result]++;
- }
- /* Use ChiSquare dist with df = 4-1 = 3, alpha = .001
- * Change to 11.34 for alpha = .01
- */
- assertTrue(
- "chi-square test -- will fail about 1 in 1000 times",
- chiSquare(expected,observed) < 16.27);
- }
-
- /** test distribution of nextLong() */
- public void testNextLong() {
- tstNextLong(null);
- }
-
- /** test distribution of nextLong(Random) BROKEN
- * contract of nextLong(Random) is different from
- * nextLong() */
- public void testNextLong2() {
- Random rnd = new Random();
- rnd.setSeed(System.currentTimeMillis());
- tstNextLong(rnd);
- }
-
- /**
- * Generate 1000 values for nextLong() and check that
- * p(value < long.MAXVALUE/2) ~ 0.5. Use chi-square test
- * with df = 2-1 = 1
- * @param rnd Random to use if not null
- */
- private void tstNextLong(Random rnd) {
- // Distribution
- int[] expected = new int[] {500,500};
- int[] observed = new int[] {0,0};
- // Even/Odd
- int[] expected2 = new int[] {500,500};
- int[] observed2 = new int[] {0,0};
- long result = 0;
- long midPoint = Long.MAX_VALUE/2;
- for (int i = 0; i < 1000; i ++) {
- if (rnd == null) {
- result = Math.abs(RandomUtils.nextLong());
- } else {
- result = Math.abs(RandomUtils.nextLong(rnd));
- }
- if (result < midPoint) {
- observed[0]++;
- } else {
- observed[1]++;
- }
- if (result % 2 == 0) {
- observed2[0]++;
- } else {
- observed2[1]++;
- }
- }
- /* Use ChiSquare dist with df = 2-1 = 1, alpha = .001
- * Change to 6.64 for alpha = .01
- */
- assertTrue(
- "mid point chi-square test -- will fail about 1 in 1000 times",
- chiSquare(expected,observed) < 10.83);
- assertTrue(
- "odd/even chi-square test -- will fail about 1 in 1000 times",
- chiSquare(expected2,observed2) < 10.83);
- }
-
-
- /** test distribution of nextBoolean() */
- public void testNextBoolean() {
- tstNextBoolean(null);
- }
-
- /** test distribution of nextBoolean(Random) */
- public void testNextBoolean2() {
- Random rnd = new Random();
- rnd.setSeed(System.currentTimeMillis());
- tstNextBoolean(rnd);
- }
-
- /**
- * Generate 1000 values for nextBoolean and check that
- * p(value = false) ~ 0.5. Use chi-square test
- * with df = 2-1 = 1
- * @param rnd Random to use if not null
- */
- private void tstNextBoolean(Random rnd) {
- int[] expected = new int[] {500,500};
- int[] observed = new int[] {0,0};
- boolean result = false;
- for (int i = 0; i < 1000; i ++) {
- if (rnd == null) {
- result = RandomUtils.nextBoolean();
- } else {
- result = RandomUtils.nextBoolean(rnd);
- }
- if (result) {
- observed[0]++;
- } else {
- observed[1]++;
- }
- }
- /* Use ChiSquare dist with df = 2-1 = 1, alpha = .001
- * Change to 6.64 for alpha = .01
- */
- assertTrue(
- "chi-square test -- will fail about 1 in 1000 times",
- chiSquare(expected,observed) < 10.83 );
- }
-
- /** test distribution of nextFloat() */
- public void testNextFloat() {
- tstNextFloat(null);
- }
-
- /** test distribution of nextFloat(Random) */
- public void testNextFloat2() {
- Random rnd = new Random();
- rnd.setSeed(System.currentTimeMillis());
- tstNextFloat(rnd);
- }
-
- /**
- * Generate 1000 values for nextFloat and check that
- * p(value < 0.5) ~ 0.5. Use chi-square test
- * with df = 2-1 = 1
- * @param rnd Random to use if not null
- */
- private void tstNextFloat(Random rnd) {
- int[] expected = new int[] {500,500};
- int[] observed = new int[] {0,0};
- float result = 0;
- for (int i = 0; i < 1000; i ++) {
- if (rnd == null) {
- result = RandomUtils.nextFloat();
- } else {
- result = RandomUtils.nextFloat(rnd);
- }
- if (result < 0.5) {
- observed[0]++;
- } else {
- observed[1]++;
- }
- }
- /* Use ChiSquare dist with df = 2-1 = 1, alpha = .001
- * Change to 6.64 for alpha = .01
- */
- assertTrue(
- "chi-square test -- will fail about 1 in 1000 times",
- chiSquare(expected,observed) < 10.83);
- }
-
- /** test distribution of nextDouble() */
- public void testNextDouble() {
- tstNextDouble(null);
- }
-
- /** test distribution of nextDouble(Random) */
- public void testNextDouble2() {
- Random rnd = new Random();
- rnd.setSeed(System.currentTimeMillis());
- tstNextDouble(rnd);
- }
-
- /**
- * Generate 1000 values for nextFloat and check that
- * p(value < 0.5) ~ 0.5. Use chi-square test
- * with df = 2-1 = 1
- * @param rnd Random to use if not null
- */
- private void tstNextDouble(Random rnd) {
- int[] expected = new int[] {500,500};
- int[] observed = new int[] {0,0};
- double result = 0;
- for (int i = 0; i < 1000; i ++) {
- if (rnd == null) {
- result = RandomUtils.nextDouble();
- } else {
- result = RandomUtils.nextDouble(rnd);
- }
- if (result < 0.5) {
- observed[0]++;
- } else {
- observed[1]++;
- }
- }
- /* Use ChiSquare dist with df = 2-1 = 1, alpha = .001
- * Change to 6.64 for alpha = .01
- */
- assertTrue(
- "chi-square test -- will fail about 1 in 1000 times",
- chiSquare(expected,observed) < 10.83);
- }
-
- /** make sure that unimplemented methods fail */
- public void testUnimplementedMethods() {
-
- try {
- RandomUtils.JVM_RANDOM.setSeed(1000);
- fail("expecting UnsupportedOperationException");
- } catch (UnsupportedOperationException ex) {
- // empty
- }
-
- try {
- RandomUtils.JVM_RANDOM.nextGaussian();
- fail("expecting UnsupportedOperationException");
- } catch (UnsupportedOperationException ex) {
- // empty
- }
-
- try {
- RandomUtils.JVM_RANDOM.nextBytes(null);
- fail("expecting UnsupportedOperationException");
- } catch (UnsupportedOperationException ex) {
- // empty
- }
-
- }
-
- /** make sure that illegal arguments fail */
- public void testIllegalArguments() {
-
- try {
- RandomUtils.JVM_RANDOM.nextInt(-1);
- fail("expecting IllegalArgumentException");
- } catch (IllegalArgumentException ex) {
- // empty
- }
-
- try {
- JVMRandom.nextLong( -1L );
- fail("expecting IllegalArgumentException");
- } catch (IllegalArgumentException ex) {
- // empty
- }
-
- }
-
- /**
- * Computes Chi-Square statistic given observed and expected counts
- * @param observed array of observed frequency counts
- * @param expected array of expected frequency counts
- */
- private double chiSquare(int[] expected, int[] observed) {
- double sumSq = 0.0d;
- double dev = 0.0d;
- for (int i = 0; i< observed.length; i++) {
- dev = (double)(observed[i] - expected[i]);
- sumSq += dev*dev/(double)expected[i];
- }
- return sumSq;
- }
-
-}
-
diff -Nur commons-lang-2.6-src-bak/src/test/java/org/apache/commons/lang/time/StopWatchTest.java commons-lang-2.6-src/src/test/java/org/apache/commons/lang/time/StopWatchTest.java
--- commons-lang-2.6-src-bak/src/test/java/org/apache/commons/lang/time/StopWatchTest.java 2019-12-04 17:52:01.847276247 +0800
+++ commons-lang-2.6-src/src/test/java/org/apache/commons/lang/time/StopWatchTest.java 1970-01-01 08:00:00.000000000 +0800
@@ -1,221 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-package org.apache.commons.lang.time;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-/**
- * TestCase for StopWatch.
- *
- * @author Apache Software Foundation
- * @version $Id: StopWatchTest.java 905636 2010-02-02 14:03:32Z niallp $
- */
-public class StopWatchTest extends TestCase {
-
- public StopWatchTest(String s) {
- super(s);
- }
-
- //-----------------------------------------------------------------------
- public void testStopWatchSimple(){
- StopWatch watch = new StopWatch();
- watch.start();
- try {Thread.sleep(550);} catch (InterruptedException ex) {}
- watch.stop();
- long time = watch.getTime();
- assertEquals(time, watch.getTime());
-
- assertTrue(time >= 500);
- assertTrue(time < 700);
-
- watch.reset();
- assertEquals(0, watch.getTime());
- }
-
- public void testStopWatchSimpleGet(){
- StopWatch watch = new StopWatch();
- assertEquals(0, watch.getTime());
- assertEquals("0:00:00.000", watch.toString());
-
- watch.start();
- try {Thread.sleep(500);} catch (InterruptedException ex) {}
- assertTrue(watch.getTime() < 2000);
- }
-
- public void testStopWatchSplit(){
- StopWatch watch = new StopWatch();
- watch.start();
- try {Thread.sleep(550);} catch (InterruptedException ex) {}
- watch.split();
- long splitTime = watch.getSplitTime();
- String splitStr = watch.toSplitString();
- try {Thread.sleep(550);} catch (InterruptedException ex) {}
- watch.unsplit();
- try {Thread.sleep(550);} catch (InterruptedException ex) {}
- watch.stop();
- long totalTime = watch.getTime();
-
- assertEquals("Formatted split string not the correct length",
- splitStr.length(), 11);
- assertTrue(splitTime >= 500);
- assertTrue(splitTime < 700);
- assertTrue(totalTime >= 1500);
- assertTrue(totalTime < 1900);
- }
-
- public void testStopWatchSuspend(){
- StopWatch watch = new StopWatch();
- watch.start();
- try {Thread.sleep(550);} catch (InterruptedException ex) {}
- watch.suspend();
- long suspendTime = watch.getTime();
- try {Thread.sleep(550);} catch (InterruptedException ex) {}
- watch.resume();
- try {Thread.sleep(550);} catch (InterruptedException ex) {}
- watch.stop();
- long totalTime = watch.getTime();
-
- assertTrue(suspendTime >= 500);
- assertTrue(suspendTime < 700);
- assertTrue(totalTime >= 1000);
- assertTrue(totalTime < 1300);
- }
-
- public void testLang315() {
- StopWatch watch = new StopWatch();
- watch.start();
- try {Thread.sleep(200);} catch (InterruptedException ex) {}
- watch.suspend();
- long suspendTime = watch.getTime();
- try {Thread.sleep(200);} catch (InterruptedException ex) {}
- watch.stop();
- long totalTime = watch.getTime();
- assertTrue( suspendTime == totalTime );
- }
-
- // test bad states
- public void testBadStates() {
- StopWatch watch = new StopWatch();
- try {
- watch.stop();
- fail("Calling stop on an unstarted StopWatch should throw an exception. ");
- } catch(IllegalStateException ise) {
- // expected
- }
-
- try {
- watch.stop();
- fail("Calling stop on an unstarted StopWatch should throw an exception. ");
- } catch(IllegalStateException ise) {
- // expected
- }
-
- try {
- watch.suspend();
- fail("Calling suspend on an unstarted StopWatch should throw an exception. ");
- } catch(IllegalStateException ise) {
- // expected
- }
-
- try {
- watch.split();
- fail("Calling split on a non-running StopWatch should throw an exception. ");
- } catch(IllegalStateException ise) {
- // expected
- }
-
- try {
- watch.unsplit();
- fail("Calling unsplit on an unsplit StopWatch should throw an exception. ");
- } catch(IllegalStateException ise) {
- // expected
- }
-
- try {
- watch.resume();
- fail("Calling resume on an unsuspended StopWatch should throw an exception. ");
- } catch(IllegalStateException ise) {
- // expected
- }
-
- watch.start();
-
- try {
- watch.start();
- fail("Calling start on a started StopWatch should throw an exception. ");
- } catch(IllegalStateException ise) {
- // expected
- }
-
- try {
- watch.unsplit();
- fail("Calling unsplit on an unsplit StopWatch should throw an exception. ");
- } catch(IllegalStateException ise) {
- // expected
- }
-
- try {
- watch.getSplitTime();
- fail("Calling getSplitTime on an unsplit StopWatch should throw an exception. ");
- } catch(IllegalStateException ise) {
- // expected
- }
-
- try {
- watch.resume();
- fail("Calling resume on an unsuspended StopWatch should throw an exception. ");
- } catch(IllegalStateException ise) {
- // expected
- }
-
- watch.stop();
-
- try {
- watch.start();
- fail("Calling start on a stopped StopWatch should throw an exception as it needs to be reset. ");
- } catch(IllegalStateException ise) {
- // expected
- }
- }
-
- public void testGetStartTime() {
- long beforeStopWatch = System.currentTimeMillis();
- StopWatch watch = new StopWatch();
- try {
- watch.getStartTime();
- fail("Calling getStartTime on an unstarted StopWatch should throw an exception");
- } catch (IllegalStateException expected) {
- // expected
- }
- watch.start();
- try {
- watch.getStartTime();
- Assert.assertTrue(watch.getStartTime() >= beforeStopWatch);
- } catch (IllegalStateException ex) {
- fail("Start time should be available: " + ex.getMessage());
- }
- watch.reset();
- try {
- watch.getStartTime();
- fail("Calling getStartTime on a reset, but unstarted StopWatch should throw an exception");
- } catch (IllegalStateException expected) {
- // expected
- }
- }
-
-}