forked from springside/springside4
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
分拆springside-core 为 springside-utils 和 springside-core, 新的example1将只依…
…赖springside-utils
- Loading branch information
Calvin
committed
Oct 11, 2014
1 parent
93d4fbb
commit 4a63d82
Showing
23 changed files
with
445 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
@echo off | ||
echo [INFO] Install jar to local repository. | ||
|
||
cd %~dp0 | ||
call mvn clean install | ||
pause |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
echo "[INFO] Install jar to local repository." | ||
|
||
mvn clean install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.springside</groupId> | ||
<artifactId>springside-parent</artifactId> | ||
<version>4.3.0-SNAPSHOT</version> | ||
<relativePath>../parent/</relativePath> | ||
</parent> | ||
<artifactId>springside-utils</artifactId> | ||
<packaging>jar</packaging> | ||
<name>Springside :: Module :: Utils</name> | ||
|
||
<dependencies> | ||
<!-- UTILS begin --> | ||
<dependency> | ||
<groupId>com.google.guava</groupId> | ||
<artifactId>guava</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-lang3</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
<dependency> | ||
<groupId>commons-codec</groupId> | ||
<artifactId>commons-codec</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
<dependency> | ||
<groupId>commons-io</groupId> | ||
<artifactId>commons-io</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
<dependency> | ||
<groupId>commons-beanutils</groupId> | ||
<artifactId>commons-beanutils</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
<!-- UTILS end --> | ||
|
||
<!-- LOGGING begin --> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
<dependency> | ||
<groupId>ch.qos.logback</groupId> | ||
<artifactId>logback-classic</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>jcl-over-slf4j</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
<!-- LOGGING end --> | ||
|
||
<!-- TEST begin --> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.assertj</groupId> | ||
<artifactId>assertj-core</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-core</artifactId> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<!-- source attach plugin --> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-source-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>attach-sources</id> | ||
<goals> | ||
<goal>jar</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
|
||
<!-- 打包测试用的jar包,classfier为tests --> | ||
<plugin> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>test-jar</goal> | ||
</goals> | ||
<configuration> | ||
<includes> | ||
<include>org/springside/modules/test/**/*.class</include> | ||
<include>jetty/webdefault-windows.xml</include> | ||
</includes> | ||
<excludes> | ||
<exclude>org/springside/modules/test/**/*Test.class</exclude> | ||
</excludes> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
|
||
<!-- enforcer, 规则统一定义在parent --> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-enforcer-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
61 changes: 61 additions & 0 deletions
61
modules/utils/src/test/java/org/springside/modules/test/data/RandomData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2005, 2014 springside.github.io | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
*******************************************************************************/ | ||
package org.springside.modules.test.data; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Random; | ||
|
||
/** | ||
* 随机测试数据生成工具类. | ||
* | ||
* @author calvin | ||
*/ | ||
public class RandomData { | ||
|
||
private static Random random = new Random(); | ||
|
||
/** | ||
* 返回随机ID. | ||
*/ | ||
public static long randomId() { | ||
return random.nextLong(); | ||
} | ||
|
||
/** | ||
* 返回随机名称, prefix字符串+5位随机数字. | ||
*/ | ||
public static String randomName(String prefix) { | ||
return prefix + random.nextInt(10000); | ||
} | ||
|
||
/** | ||
* 从输入list中随机返回一个对象. | ||
*/ | ||
public static <T> T randomOne(List<T> list) { | ||
Collections.shuffle(list); | ||
return list.get(0); | ||
} | ||
|
||
/** | ||
* 从输入list中随机返回n个对象. | ||
*/ | ||
public static <T> List<T> randomSome(List<T> list, int n) { | ||
Collections.shuffle(list); | ||
return list.subList(0, n); | ||
} | ||
|
||
/** | ||
* 从输入list中随机返回随机个对象. | ||
*/ | ||
public static <T> List<T> randomSome(List<T> list) { | ||
int size = random.nextInt(list.size()); | ||
if (size == 0) { | ||
size = 1; | ||
} | ||
return randomSome(list, size); | ||
} | ||
} |
Oops, something went wrong.