规范package,为发布到maven central repository做准备

This commit is contained in:
Daniel Qian
2014-10-14 16:23:00 +08:00
parent fef9f82b23
commit e9cb1b79de
94 changed files with 466 additions and 449 deletions

1
.gitignore vendored
View File

@@ -18,3 +18,4 @@ target
src/test/resources/test-config.xml
sw-pom.xml
*.iml

240
pom.xml
View File

@@ -1,126 +1,128 @@
<?xml version="1.0"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>chanjarster.weixin</groupId>
<artifactId>weixin-java-tools</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>WeiXin Java Toolset</name>
<url>https://github.com/chanjarster/weixin-java</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<downloadJavadocs>true</downloadJavadocs>
<downloadSources>true</downloadSources>
<httpclient.version>4.3.5</httpclient.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>fluent-hc</artifactId>
<version>${httpclient.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>${httpclient.version}</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.7</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.2.7</version>
</dependency>
<dependency>
<groupId>org.apache.oltu.oauth2</groupId>
<artifactId>org.apache.oltu.oauth2.client</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.1</version>
</dependency>
</dependencies>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>me.chanjar</groupId>
<artifactId>weixin-java-tools</artifactId>
<version>1.0.0</version>
<name>WeiXin Java Tools</name>
<url>https://github.com/chanjarster/weixin-java</url>
<description>用于开发微信公众号的Java工具</description>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<charset>UTF-8</charset>
<locale>zh_CN</locale>
</configuration>
</plugin>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<downloadJavadocs>true</downloadJavadocs>
<downloadSources>true</downloadSources>
<httpclient.version>4.3.5</httpclient.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>fluent-hc</artifactId>
<version>${httpclient.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>${httpclient.version}</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.7</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.2.7</version>
</dependency>
<dependency>
<groupId>org.apache.oltu.oauth2</groupId>
<artifactId>org.apache.oltu.oauth2.client</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.1</version>
</dependency>
</dependencies>
</plugins>
</build>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<charset>UTF-8</charset>
<locale>zh_CN</locale>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -1,6 +1,6 @@
package chanjarster.weixin.api;
package me.chanjar.weixin.api;
import chanjarster.weixin.bean.WxAccessToken;
import me.chanjar.weixin.bean.WxAccessToken;
/**
* 微信客户端配置存储

View File

@@ -1,4 +1,4 @@
package chanjarster.weixin.api;
package me.chanjar.weixin.api;
import java.util.HashMap;
import java.util.Map;

View File

@@ -1,6 +1,6 @@
package chanjarster.weixin.api;
package me.chanjar.weixin.api;
import chanjarster.weixin.bean.WxAccessToken;
import me.chanjar.weixin.bean.WxAccessToken;
/**
* 基于内存的微信配置provider在实际生产环境中应该将这些配置持久化

View File

@@ -1,9 +1,9 @@
package chanjarster.weixin.api;
package me.chanjar.weixin.api;
import java.util.Map;
import chanjarster.weixin.bean.WxXmlMessage;
import chanjarster.weixin.bean.WxXmlOutMessage;
import me.chanjar.weixin.bean.WxXmlMessage;
import me.chanjar.weixin.bean.WxXmlOutMessage;
/**
* 处理微信推送消息的处理器接口

View File

@@ -1,8 +1,8 @@
package chanjarster.weixin.api;
package me.chanjar.weixin.api;
import java.util.Map;
import chanjarster.weixin.bean.WxXmlMessage;
import me.chanjar.weixin.bean.WxXmlMessage;
/**

View File

@@ -1,4 +1,4 @@
package chanjarster.weixin.api;
package me.chanjar.weixin.api;
import java.util.ArrayList;
import java.util.HashMap;
@@ -8,8 +8,8 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.regex.Pattern;
import chanjarster.weixin.bean.WxXmlMessage;
import chanjarster.weixin.bean.WxXmlOutMessage;
import me.chanjar.weixin.bean.WxXmlMessage;
import me.chanjar.weixin.bean.WxXmlOutMessage;
/**
* <pre>

View File

@@ -1,24 +1,24 @@
package chanjarster.weixin.api;
package me.chanjar.weixin.api;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import chanjarster.weixin.bean.WxCustomMessage;
import chanjarster.weixin.bean.WxGroup;
import chanjarster.weixin.bean.WxMassGroupMessage;
import chanjarster.weixin.bean.WxMassNews;
import chanjarster.weixin.bean.WxMassOpenIdsMessage;
import chanjarster.weixin.bean.WxMassVideo;
import chanjarster.weixin.bean.WxMenu;
import chanjarster.weixin.bean.result.WxMassSendResult;
import chanjarster.weixin.bean.result.WxMassUploadResult;
import chanjarster.weixin.bean.result.WxMediaUploadResult;
import chanjarster.weixin.bean.result.WxQrCodeTicket;
import chanjarster.weixin.bean.result.WxUser;
import chanjarster.weixin.bean.result.WxUserList;
import chanjarster.weixin.exception.WxErrorException;
import me.chanjar.weixin.bean.WxCustomMessage;
import me.chanjar.weixin.bean.WxGroup;
import me.chanjar.weixin.bean.WxMassGroupMessage;
import me.chanjar.weixin.bean.WxMassNews;
import me.chanjar.weixin.bean.WxMassOpenIdsMessage;
import me.chanjar.weixin.bean.WxMassVideo;
import me.chanjar.weixin.bean.WxMenu;
import me.chanjar.weixin.bean.result.WxMassSendResult;
import me.chanjar.weixin.bean.result.WxMassUploadResult;
import me.chanjar.weixin.bean.result.WxMediaUploadResult;
import me.chanjar.weixin.bean.result.WxQrCodeTicket;
import me.chanjar.weixin.bean.result.WxUser;
import me.chanjar.weixin.bean.result.WxUserList;
import me.chanjar.weixin.exception.WxErrorException;
/**
* 微信API的Service

View File

@@ -1,4 +1,4 @@
package chanjarster.weixin.api;
package me.chanjar.weixin.api;
import java.io.File;
import java.io.IOException;
@@ -10,6 +10,8 @@ import java.util.List;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicBoolean;
import me.chanjar.weixin.bean.WxCustomMessage;
import me.chanjar.weixin.util.json.GsonHelper;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.CloseableHttpResponse;
@@ -18,31 +20,29 @@ import org.apache.http.impl.client.BasicResponseHandler;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import chanjarster.weixin.bean.WxAccessToken;
import chanjarster.weixin.bean.WxCustomMessage;
import chanjarster.weixin.bean.WxGroup;
import chanjarster.weixin.bean.WxMassGroupMessage;
import chanjarster.weixin.bean.WxMassNews;
import chanjarster.weixin.bean.WxMassOpenIdsMessage;
import chanjarster.weixin.bean.WxMassVideo;
import chanjarster.weixin.bean.WxMenu;
import chanjarster.weixin.bean.result.WxError;
import chanjarster.weixin.bean.result.WxMassSendResult;
import chanjarster.weixin.bean.result.WxMassUploadResult;
import chanjarster.weixin.bean.result.WxMediaUploadResult;
import chanjarster.weixin.bean.result.WxQrCodeTicket;
import chanjarster.weixin.bean.result.WxUser;
import chanjarster.weixin.bean.result.WxUserList;
import chanjarster.weixin.exception.WxErrorException;
import chanjarster.weixin.util.fs.FileUtils;
import chanjarster.weixin.util.http.MediaDownloadRequestExecutor;
import chanjarster.weixin.util.http.MediaUploadRequestExecutor;
import chanjarster.weixin.util.http.QrCodeRequestExecutor;
import chanjarster.weixin.util.http.RequestExecutor;
import chanjarster.weixin.util.http.SimpleGetRequestExecutor;
import chanjarster.weixin.util.http.SimplePostRequestExecutor;
import chanjarster.weixin.util.json.GsonHelper;
import chanjarster.weixin.util.json.WxGsonBuilder;
import me.chanjar.weixin.bean.WxAccessToken;
import me.chanjar.weixin.bean.WxGroup;
import me.chanjar.weixin.bean.WxMassGroupMessage;
import me.chanjar.weixin.bean.WxMassNews;
import me.chanjar.weixin.bean.WxMassOpenIdsMessage;
import me.chanjar.weixin.bean.WxMassVideo;
import me.chanjar.weixin.bean.WxMenu;
import me.chanjar.weixin.bean.result.WxError;
import me.chanjar.weixin.bean.result.WxMassSendResult;
import me.chanjar.weixin.bean.result.WxMassUploadResult;
import me.chanjar.weixin.bean.result.WxMediaUploadResult;
import me.chanjar.weixin.bean.result.WxQrCodeTicket;
import me.chanjar.weixin.bean.result.WxUser;
import me.chanjar.weixin.bean.result.WxUserList;
import me.chanjar.weixin.exception.WxErrorException;
import me.chanjar.weixin.util.fs.FileUtils;
import me.chanjar.weixin.util.http.MediaDownloadRequestExecutor;
import me.chanjar.weixin.util.http.MediaUploadRequestExecutor;
import me.chanjar.weixin.util.http.QrCodeRequestExecutor;
import me.chanjar.weixin.util.http.RequestExecutor;
import me.chanjar.weixin.util.http.SimpleGetRequestExecutor;
import me.chanjar.weixin.util.http.SimplePostRequestExecutor;
import me.chanjar.weixin.util.json.WxGsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;

View File

@@ -1,6 +1,6 @@
package chanjarster.weixin.bean;
package me.chanjar.weixin.bean;
import chanjarster.weixin.util.json.WxGsonBuilder;
import me.chanjar.weixin.util.json.WxGsonBuilder;
public class WxAccessToken {

View File

@@ -1,16 +1,16 @@
package chanjarster.weixin.bean;
package me.chanjar.weixin.bean;
import java.util.ArrayList;
import java.util.List;
import chanjarster.weixin.api.WxConsts;
import chanjarster.weixin.bean.custombuilder.ImageBuilder;
import chanjarster.weixin.bean.custombuilder.MusicBuilder;
import chanjarster.weixin.bean.custombuilder.NewsBuilder;
import chanjarster.weixin.bean.custombuilder.TextBuilder;
import chanjarster.weixin.bean.custombuilder.VideoBuilder;
import chanjarster.weixin.bean.custombuilder.VoiceBuilder;
import chanjarster.weixin.util.json.WxGsonBuilder;
import me.chanjar.weixin.api.WxConsts;
import me.chanjar.weixin.bean.custombuilder.ImageBuilder;
import me.chanjar.weixin.bean.custombuilder.MusicBuilder;
import me.chanjar.weixin.bean.custombuilder.NewsBuilder;
import me.chanjar.weixin.bean.custombuilder.TextBuilder;
import me.chanjar.weixin.bean.custombuilder.VideoBuilder;
import me.chanjar.weixin.bean.custombuilder.VoiceBuilder;
import me.chanjar.weixin.util.json.WxGsonBuilder;
/**
* 客服消息

View File

@@ -1,6 +1,6 @@
package chanjarster.weixin.bean;
package me.chanjar.weixin.bean;
import chanjarster.weixin.util.json.WxGsonBuilder;
import me.chanjar.weixin.util.json.WxGsonBuilder;
/**
* 微信用户分组

View File

@@ -1,7 +1,7 @@
package chanjarster.weixin.bean;
package me.chanjar.weixin.bean;
import chanjarster.weixin.api.WxConsts;
import chanjarster.weixin.util.json.WxGsonBuilder;
import me.chanjar.weixin.api.WxConsts;
import me.chanjar.weixin.util.json.WxGsonBuilder;
/**
* 分组群发的消息

View File

@@ -1,9 +1,9 @@
package chanjarster.weixin.bean;
package me.chanjar.weixin.bean;
import java.util.ArrayList;
import java.util.List;
import chanjarster.weixin.util.json.WxGsonBuilder;
import me.chanjar.weixin.util.json.WxGsonBuilder;
/**
* 群发时用到的图文消息素材

View File

@@ -1,10 +1,9 @@
package chanjarster.weixin.bean;
package me.chanjar.weixin.bean;
import java.util.ArrayList;
import java.util.List;
import chanjarster.weixin.api.WxConsts;
import chanjarster.weixin.util.json.WxGsonBuilder;
import me.chanjar.weixin.util.json.WxGsonBuilder;
/**
* OpenId列表群发的消息
@@ -29,11 +28,11 @@ public class WxMassOpenIdsMessage {
/**
* <pre>
* 请使用
* {@link WxConsts#MASS_MSG_IMAGE}
* {@link WxConsts#MASS_MSG_NEWS}
* {@link WxConsts#MASS_MSG_TEXT}
* {@link WxConsts#MASS_MSG_VIDEO}
* {@link WxConsts#MASS_MSG_VOICE}
* {@link me.chanjar.weixin.api.WxConsts#MASS_MSG_IMAGE}
* {@link me.chanjar.weixin.api.WxConsts#MASS_MSG_NEWS}
* {@link me.chanjar.weixin.api.WxConsts#MASS_MSG_TEXT}
* {@link me.chanjar.weixin.api.WxConsts#MASS_MSG_VIDEO}
* {@link me.chanjar.weixin.api.WxConsts#MASS_MSG_VOICE}
* 如果msgtype和media_id不匹配的话会返回系统繁忙的错误
* </pre>
* @param msgtype

View File

@@ -1,6 +1,6 @@
package chanjarster.weixin.bean;
package me.chanjar.weixin.bean;
import chanjarster.weixin.util.json.WxGsonBuilder;
import me.chanjar.weixin.util.json.WxGsonBuilder;
/**
* 群发时用到的视频素材

View File

@@ -1,11 +1,11 @@
package chanjarster.weixin.bean;
package me.chanjar.weixin.bean;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import chanjarster.weixin.util.json.WxGsonBuilder;
import me.chanjar.weixin.util.json.WxGsonBuilder;
/**
* 公众号菜单

View File

@@ -1,4 +1,4 @@
package chanjarster.weixin.bean;
package me.chanjar.weixin.bean;
import java.io.InputStream;
@@ -9,9 +9,9 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import chanjarster.weixin.api.WxConsts;
import chanjarster.weixin.util.xml.AdapterCDATA;
import chanjarster.weixin.util.xml.XmlTransformer;
import me.chanjar.weixin.api.WxConsts;
import me.chanjar.weixin.util.xml.AdapterCDATA;
import me.chanjar.weixin.util.xml.XmlTransformer;
/**
* <pre>

View File

@@ -1,4 +1,4 @@
package chanjarster.weixin.bean;
package me.chanjar.weixin.bean;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
@@ -6,8 +6,8 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import chanjarster.weixin.api.WxConsts;
import chanjarster.weixin.util.xml.MediaIdMarshaller;
import me.chanjar.weixin.api.WxConsts;
import me.chanjar.weixin.util.xml.MediaIdMarshaller;
@XmlRootElement(name = "xml")
@XmlAccessorType(XmlAccessType.FIELD)

View File

@@ -1,4 +1,4 @@
package chanjarster.weixin.bean;
package me.chanjar.weixin.bean;
import javax.xml.bind.JAXBException;
import javax.xml.bind.annotation.XmlAccessType;
@@ -7,14 +7,14 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import chanjarster.weixin.bean.outxmlbuilder.ImageBuilder;
import chanjarster.weixin.bean.outxmlbuilder.MusicBuilder;
import chanjarster.weixin.bean.outxmlbuilder.NewsBuilder;
import chanjarster.weixin.bean.outxmlbuilder.TextBuilder;
import chanjarster.weixin.bean.outxmlbuilder.VideoBuilder;
import chanjarster.weixin.bean.outxmlbuilder.VoiceBuilder;
import chanjarster.weixin.util.xml.AdapterCDATA;
import chanjarster.weixin.util.xml.XmlTransformer;
import me.chanjar.weixin.bean.outxmlbuilder.ImageBuilder;
import me.chanjar.weixin.bean.outxmlbuilder.MusicBuilder;
import me.chanjar.weixin.bean.outxmlbuilder.NewsBuilder;
import me.chanjar.weixin.bean.outxmlbuilder.TextBuilder;
import me.chanjar.weixin.bean.outxmlbuilder.VideoBuilder;
import me.chanjar.weixin.bean.outxmlbuilder.VoiceBuilder;
import me.chanjar.weixin.util.xml.AdapterCDATA;
import me.chanjar.weixin.util.xml.XmlTransformer;
@XmlRootElement(name = "xml")
@XmlAccessorType(XmlAccessType.FIELD)

View File

@@ -1,4 +1,4 @@
package chanjarster.weixin.bean;
package me.chanjar.weixin.bean;
import java.util.ArrayList;
import java.util.List;
@@ -10,8 +10,8 @@ import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import chanjarster.weixin.api.WxConsts;
import chanjarster.weixin.util.xml.AdapterCDATA;
import me.chanjar.weixin.api.WxConsts;
import me.chanjar.weixin.util.xml.AdapterCDATA;
@XmlRootElement(name = "xml")
@XmlAccessorType(XmlAccessType.FIELD)

View File

@@ -1,4 +1,4 @@
package chanjarster.weixin.bean;
package me.chanjar.weixin.bean;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
@@ -6,8 +6,8 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import chanjarster.weixin.api.WxConsts;
import chanjarster.weixin.util.xml.AdapterCDATA;
import me.chanjar.weixin.api.WxConsts;
import me.chanjar.weixin.util.xml.AdapterCDATA;
@XmlRootElement(name = "xml")
@XmlAccessorType(XmlAccessType.FIELD)

View File

@@ -1,4 +1,4 @@
package chanjarster.weixin.bean;
package me.chanjar.weixin.bean;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
@@ -6,8 +6,8 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import chanjarster.weixin.api.WxConsts;
import chanjarster.weixin.util.xml.AdapterCDATA;
import me.chanjar.weixin.api.WxConsts;
import me.chanjar.weixin.util.xml.AdapterCDATA;
@XmlRootElement(name = "xml")
@XmlAccessorType(XmlAccessType.FIELD)

View File

@@ -1,4 +1,4 @@
package chanjarster.weixin.bean;
package me.chanjar.weixin.bean;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
@@ -6,8 +6,8 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import chanjarster.weixin.api.WxConsts;
import chanjarster.weixin.util.xml.AdapterCDATA;
import me.chanjar.weixin.api.WxConsts;
import me.chanjar.weixin.util.xml.AdapterCDATA;
@XmlRootElement(name = "xml")
@XmlAccessorType(XmlAccessType.FIELD)

View File

@@ -1,4 +1,4 @@
package chanjarster.weixin.bean;
package me.chanjar.weixin.bean;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
@@ -6,8 +6,8 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import chanjarster.weixin.api.WxConsts;
import chanjarster.weixin.util.xml.MediaIdMarshaller;
import me.chanjar.weixin.api.WxConsts;
import me.chanjar.weixin.util.xml.MediaIdMarshaller;
@XmlRootElement(name = "xml")
@XmlAccessorType(XmlAccessType.FIELD)

View File

@@ -1,6 +1,6 @@
package chanjarster.weixin.bean.custombuilder;
package me.chanjar.weixin.bean.custombuilder;
import chanjarster.weixin.bean.WxCustomMessage;
import me.chanjar.weixin.bean.WxCustomMessage;
public class BaseBuilder<T> {
protected String msgtype;

View File

@@ -1,7 +1,7 @@
package chanjarster.weixin.bean.custombuilder;
package me.chanjar.weixin.bean.custombuilder;
import chanjarster.weixin.api.WxConsts;
import chanjarster.weixin.bean.WxCustomMessage;
import me.chanjar.weixin.api.WxConsts;
import me.chanjar.weixin.bean.WxCustomMessage;
/**
* 获得消息builder

View File

@@ -1,7 +1,7 @@
package chanjarster.weixin.bean.custombuilder;
package me.chanjar.weixin.bean.custombuilder;
import chanjarster.weixin.api.WxConsts;
import chanjarster.weixin.bean.WxCustomMessage;
import me.chanjar.weixin.api.WxConsts;
import me.chanjar.weixin.bean.WxCustomMessage;
/**
* 音乐消息builder

View File

@@ -1,11 +1,10 @@
package chanjarster.weixin.bean.custombuilder;
package me.chanjar.weixin.bean.custombuilder;
import java.util.ArrayList;
import java.util.List;
import chanjarster.weixin.api.WxConsts;
import chanjarster.weixin.bean.WxCustomMessage;
import chanjarster.weixin.bean.WxCustomMessage.WxArticle;
import me.chanjar.weixin.api.WxConsts;
import me.chanjar.weixin.bean.WxCustomMessage;
/**
* 图文消息builder
@@ -18,7 +17,7 @@ import chanjarster.weixin.bean.WxCustomMessage.WxArticle;
*/
public final class NewsBuilder extends BaseBuilder<NewsBuilder> {
private List<WxArticle> articles = new ArrayList<WxArticle>();
private List<WxCustomMessage.WxArticle> articles = new ArrayList<WxCustomMessage.WxArticle>();
public NewsBuilder() {
this.msgtype = WxConsts.CUSTOM_MSG_NEWS;

View File

@@ -1,7 +1,7 @@
package chanjarster.weixin.bean.custombuilder;
package me.chanjar.weixin.bean.custombuilder;
import chanjarster.weixin.api.WxConsts;
import chanjarster.weixin.bean.WxCustomMessage;
import me.chanjar.weixin.api.WxConsts;
import me.chanjar.weixin.bean.WxCustomMessage;
/**
* 文本消息builder

View File

@@ -1,7 +1,7 @@
package chanjarster.weixin.bean.custombuilder;
package me.chanjar.weixin.bean.custombuilder;
import chanjarster.weixin.api.WxConsts;
import chanjarster.weixin.bean.WxCustomMessage;
import me.chanjar.weixin.api.WxConsts;
import me.chanjar.weixin.bean.WxCustomMessage;
/**
* 视频消息builder

View File

@@ -1,7 +1,7 @@
package chanjarster.weixin.bean.custombuilder;
package me.chanjar.weixin.bean.custombuilder;
import chanjarster.weixin.api.WxConsts;
import chanjarster.weixin.bean.WxCustomMessage;
import me.chanjar.weixin.api.WxConsts;
import me.chanjar.weixin.bean.WxCustomMessage;
/**
* 语音消息builder

View File

@@ -1,6 +1,6 @@
package chanjarster.weixin.bean.outxmlbuilder;
package me.chanjar.weixin.bean.outxmlbuilder;
import chanjarster.weixin.bean.WxXmlOutMessage;
import me.chanjar.weixin.bean.WxXmlOutMessage;
public abstract class BaseBuilder<BuilderType, ValueType> {

View File

@@ -1,6 +1,6 @@
package chanjarster.weixin.bean.outxmlbuilder;
package me.chanjar.weixin.bean.outxmlbuilder;
import chanjarster.weixin.bean.WxXmlOutImageMessage;
import me.chanjar.weixin.bean.WxXmlOutImageMessage;
/**
* 图片消息builder

View File

@@ -1,6 +1,6 @@
package chanjarster.weixin.bean.outxmlbuilder;
package me.chanjar.weixin.bean.outxmlbuilder;
import chanjarster.weixin.bean.WxXmlOutMusicMessage;
import me.chanjar.weixin.bean.WxXmlOutMusicMessage;
/**
* 音乐消息builder

View File

@@ -1,10 +1,10 @@
package chanjarster.weixin.bean.outxmlbuilder;
package me.chanjar.weixin.bean.outxmlbuilder;
import java.util.ArrayList;
import java.util.List;
import chanjarster.weixin.bean.WxXmlOutMewsMessage;
import chanjarster.weixin.bean.WxXmlOutMewsMessage.Item;
import me.chanjar.weixin.bean.WxXmlOutMewsMessage;
import me.chanjar.weixin.bean.WxXmlOutMewsMessage.Item;
/**
* 图文消息builder

View File

@@ -1,6 +1,6 @@
package chanjarster.weixin.bean.outxmlbuilder;
package me.chanjar.weixin.bean.outxmlbuilder;
import chanjarster.weixin.bean.WxXmlOutTextMessage;
import me.chanjar.weixin.bean.WxXmlOutTextMessage;
/**
* 文本消息builder

View File

@@ -1,6 +1,6 @@
package chanjarster.weixin.bean.outxmlbuilder;
package me.chanjar.weixin.bean.outxmlbuilder;
import chanjarster.weixin.bean.WxXmlOutVideoMessage;
import me.chanjar.weixin.bean.WxXmlOutVideoMessage;
/**
* 视频消息builder

View File

@@ -1,6 +1,6 @@
package chanjarster.weixin.bean.outxmlbuilder;
package me.chanjar.weixin.bean.outxmlbuilder;
import chanjarster.weixin.bean.WxXmlOutVoiceMessage;
import me.chanjar.weixin.bean.WxXmlOutVoiceMessage;
/**
* 语音消息builder

View File

@@ -1,9 +1,9 @@
package chanjarster.weixin.bean.result;
package me.chanjar.weixin.bean.result;
import java.util.HashMap;
import java.util.Map;
import chanjarster.weixin.util.json.WxGsonBuilder;
import me.chanjar.weixin.util.json.WxGsonBuilder;
/**
* 微信错误码说明

View File

@@ -1,6 +1,6 @@
package chanjarster.weixin.bean.result;
package me.chanjar.weixin.bean.result;
import chanjarster.weixin.util.json.WxGsonBuilder;
import me.chanjar.weixin.util.json.WxGsonBuilder;
/**
* <pre>

View File

@@ -1,6 +1,6 @@
package chanjarster.weixin.bean.result;
package me.chanjar.weixin.bean.result;
import chanjarster.weixin.util.json.WxGsonBuilder;
import me.chanjar.weixin.util.json.WxGsonBuilder;
/**
* <pre>

View File

@@ -1,6 +1,6 @@
package chanjarster.weixin.bean.result;
package me.chanjar.weixin.bean.result;
import chanjarster.weixin.util.json.WxGsonBuilder;
import me.chanjar.weixin.util.json.WxGsonBuilder;
public class WxMediaUploadResult {

View File

@@ -1,6 +1,6 @@
package chanjarster.weixin.bean.result;
package me.chanjar.weixin.bean.result;
import chanjarster.weixin.util.json.WxGsonBuilder;
import me.chanjar.weixin.util.json.WxGsonBuilder;
/**
* 换取二维码的Ticket

View File

@@ -1,6 +1,6 @@
package chanjarster.weixin.bean.result;
package me.chanjar.weixin.bean.result;
import chanjarster.weixin.util.json.WxGsonBuilder;
import me.chanjar.weixin.util.json.WxGsonBuilder;
/**
* 微信用户信息

View File

@@ -1,9 +1,9 @@
package chanjarster.weixin.bean.result;
package me.chanjar.weixin.bean.result;
import java.util.ArrayList;
import java.util.List;
import chanjarster.weixin.util.json.WxGsonBuilder;
import me.chanjar.weixin.util.json.WxGsonBuilder;
/**

View File

@@ -1,6 +1,6 @@
package chanjarster.weixin.exception;
package me.chanjar.weixin.exception;
import chanjarster.weixin.bean.result.WxError;
import me.chanjar.weixin.bean.result.WxError;
public class WxErrorException extends Exception {

View File

@@ -1,4 +1,4 @@
package chanjarster.weixin.util.fs;
package me.chanjar.weixin.util.fs;
import java.io.File;
import java.io.FileOutputStream;

View File

@@ -1,4 +1,4 @@
package chanjarster.weixin.util.http;
package me.chanjar.weixin.util.http;
import java.io.IOException;
import java.io.InputStream;

View File

@@ -1,4 +1,4 @@
package chanjarster.weixin.util.http;
package me.chanjar.weixin.util.http;
import java.io.File;
import java.io.IOException;
@@ -13,9 +13,9 @@ import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.entity.ContentType;
import chanjarster.weixin.bean.result.WxError;
import chanjarster.weixin.exception.WxErrorException;
import chanjarster.weixin.util.fs.FileUtils;
import me.chanjar.weixin.bean.result.WxError;
import me.chanjar.weixin.exception.WxErrorException;
import me.chanjar.weixin.util.fs.FileUtils;
/**
* 下载媒体文件请求执行器请求的参数是String, 返回的结果是File

View File

@@ -1,4 +1,4 @@
package chanjarster.weixin.util.http;
package me.chanjar.weixin.util.http;
import java.io.File;
import java.io.IOException;
@@ -10,9 +10,9 @@ import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import chanjarster.weixin.bean.result.WxError;
import chanjarster.weixin.bean.result.WxMediaUploadResult;
import chanjarster.weixin.exception.WxErrorException;
import me.chanjar.weixin.bean.result.WxError;
import me.chanjar.weixin.bean.result.WxMediaUploadResult;
import me.chanjar.weixin.exception.WxErrorException;
/**
* 上传媒体文件请求执行器请求的参数是File, 返回的结果是String

View File

@@ -1,4 +1,4 @@
package chanjarster.weixin.util.http;
package me.chanjar.weixin.util.http;
import java.io.File;
import java.io.IOException;
@@ -12,10 +12,10 @@ import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.entity.ContentType;
import chanjarster.weixin.bean.result.WxError;
import chanjarster.weixin.bean.result.WxQrCodeTicket;
import chanjarster.weixin.exception.WxErrorException;
import chanjarster.weixin.util.fs.FileUtils;
import me.chanjar.weixin.bean.result.WxError;
import me.chanjar.weixin.bean.result.WxQrCodeTicket;
import me.chanjar.weixin.exception.WxErrorException;
import me.chanjar.weixin.util.fs.FileUtils;
/**
* 获得QrCode图片 请求执行器

View File

@@ -1,4 +1,4 @@
package chanjarster.weixin.util.http;
package me.chanjar.weixin.util.http;
import java.io.IOException;
@@ -6,7 +6,7 @@ import org.apache.http.client.ClientProtocolException;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import chanjarster.weixin.exception.WxErrorException;
import me.chanjar.weixin.exception.WxErrorException;
/**
* http请求执行器

View File

@@ -1,4 +1,4 @@
package chanjarster.weixin.util.http;
package me.chanjar.weixin.util.http;
import java.io.IOException;
@@ -6,8 +6,8 @@ import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import chanjarster.weixin.bean.result.WxError;
import chanjarster.weixin.exception.WxErrorException;
import me.chanjar.weixin.bean.result.WxError;
import me.chanjar.weixin.exception.WxErrorException;
/**
* 简单的GET请求执行器请求的参数是String, 返回的结果也是String

View File

@@ -1,16 +1,15 @@
package chanjarster.weixin.util.http;
package me.chanjar.weixin.util.http;
import java.io.IOException;
import me.chanjar.weixin.bean.result.WxError;
import me.chanjar.weixin.exception.WxErrorException;
import org.apache.http.Consts;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import chanjarster.weixin.bean.result.WxError;
import chanjarster.weixin.exception.WxErrorException;
/**
* 简单的POST请求执行器请求的参数是String, 返回的结果也是String
* @author chanjarster

View File

@@ -1,4 +1,4 @@
package chanjarster.weixin.util.http;
package me.chanjar.weixin.util.http;
import java.io.IOException;

View File

@@ -6,7 +6,7 @@
* arose from modification of the original source, or other redistribution of this source
* is not permitted without written permission of the KINGSTAR MEDIA SOLUTIONS LTD.
*/
package chanjarster.weixin.util.json;
package me.chanjar.weixin.util.json;
import com.google.gson.JsonElement;

View File

@@ -6,13 +6,12 @@
* arose from modification of the original source, or other redistribution of this source
* is not permitted without written permission of the KINGSTAR MEDIA SOLUTIONS LTD.
*/
package chanjarster.weixin.util.json;
package me.chanjar.weixin.util.json;
import java.lang.reflect.Type;
import chanjarster.weixin.api.WxConsts;
import chanjarster.weixin.bean.WxCustomMessage;
import chanjarster.weixin.bean.WxCustomMessage.WxArticle;
import me.chanjar.weixin.api.WxConsts;
import me.chanjar.weixin.bean.WxCustomMessage;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
@@ -71,7 +70,7 @@ public class WxCustomMessageGsonAdapter implements JsonSerializer<WxCustomMessag
if (WxConsts.CUSTOM_MSG_NEWS.equals(message.getMsgtype())) {
JsonArray articleJsonArray = new JsonArray();
for (WxArticle article : message.getArticles()) {
for (WxCustomMessage.WxArticle article : message.getArticles()) {
JsonObject articleJson = new JsonObject();
articleJson.addProperty("title", article.getTitle());
articleJson.addProperty("description", article.getDescription());

View File

@@ -6,11 +6,11 @@
* arose from modification of the original source, or other redistribution of this source
* is not permitted without written permission of the KINGSTAR MEDIA SOLUTIONS LTD.
*/
package chanjarster.weixin.util.json;
package me.chanjar.weixin.util.json;
import java.lang.reflect.Type;
import chanjarster.weixin.bean.WxGroup;
import me.chanjar.weixin.bean.WxGroup;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;

View File

@@ -1,13 +1,13 @@
package chanjarster.weixin.util.json;
package me.chanjar.weixin.util.json;
import chanjarster.weixin.bean.WxCustomMessage;
import chanjarster.weixin.bean.WxGroup;
import chanjarster.weixin.bean.WxMassGroupMessage;
import chanjarster.weixin.bean.WxMassNews;
import chanjarster.weixin.bean.WxMassOpenIdsMessage;
import chanjarster.weixin.bean.WxMenu;
import chanjarster.weixin.bean.result.WxUser;
import chanjarster.weixin.bean.result.WxUserList;
import me.chanjar.weixin.bean.WxCustomMessage;
import me.chanjar.weixin.bean.WxGroup;
import me.chanjar.weixin.bean.WxMassGroupMessage;
import me.chanjar.weixin.bean.WxMassNews;
import me.chanjar.weixin.bean.WxMassOpenIdsMessage;
import me.chanjar.weixin.bean.WxMenu;
import me.chanjar.weixin.bean.result.WxUser;
import me.chanjar.weixin.bean.result.WxUserList;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

View File

@@ -6,12 +6,12 @@
* arose from modification of the original source, or other redistribution of this source
* is not permitted without written permission of the KINGSTAR MEDIA SOLUTIONS LTD.
*/
package chanjarster.weixin.util.json;
package me.chanjar.weixin.util.json;
import java.lang.reflect.Type;
import chanjarster.weixin.api.WxConsts;
import chanjarster.weixin.bean.WxMassGroupMessage;
import me.chanjar.weixin.api.WxConsts;
import me.chanjar.weixin.bean.WxMassGroupMessage;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;

View File

@@ -6,12 +6,11 @@
* arose from modification of the original source, or other redistribution of this source
* is not permitted without written permission of the KINGSTAR MEDIA SOLUTIONS LTD.
*/
package chanjarster.weixin.util.json;
package me.chanjar.weixin.util.json;
import java.lang.reflect.Type;
import chanjarster.weixin.bean.WxMassNews;
import chanjarster.weixin.bean.WxMassNews.WxMassNewsArticle;
import me.chanjar.weixin.bean.WxMassNews;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
@@ -30,7 +29,7 @@ public class WxMassNewsGsonAdapter implements JsonSerializer<WxMassNews> {
JsonObject newsJson = new JsonObject();
JsonArray articleJsonArray = new JsonArray();
for (WxMassNewsArticle article : message.getArticles()) {
for (WxMassNews.WxMassNewsArticle article : message.getArticles()) {
JsonObject articleJson = new JsonObject();
articleJson.addProperty("thumb_media_id", article.getThumb_media_id());
articleJson.addProperty("title", article.getTitle());

View File

@@ -6,12 +6,12 @@
* arose from modification of the original source, or other redistribution of this source
* is not permitted without written permission of the KINGSTAR MEDIA SOLUTIONS LTD.
*/
package chanjarster.weixin.util.json;
package me.chanjar.weixin.util.json;
import java.lang.reflect.Type;
import chanjarster.weixin.api.WxConsts;
import chanjarster.weixin.bean.WxMassOpenIdsMessage;
import me.chanjar.weixin.api.WxConsts;
import me.chanjar.weixin.bean.WxMassOpenIdsMessage;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;

View File

@@ -6,12 +6,11 @@
* arose from modification of the original source, or other redistribution of this source
* is not permitted without written permission of the KINGSTAR MEDIA SOLUTIONS LTD.
*/
package chanjarster.weixin.util.json;
package me.chanjar.weixin.util.json;
import java.lang.reflect.Type;
import chanjarster.weixin.bean.WxMenu;
import chanjarster.weixin.bean.WxMenu.WxMenuButton;
import me.chanjar.weixin.bean.WxMenu;
import com.google.gson.JsonArray;
import com.google.gson.JsonDeserializationContext;
@@ -33,7 +32,7 @@ public class WxMenuGsonAdapter implements JsonSerializer<WxMenu>, JsonDeserializ
JsonObject json = new JsonObject();
JsonArray buttonArray = new JsonArray();
for (WxMenuButton button : menu.getButton()) {
for (WxMenu.WxMenuButton button : menu.getButton()) {
JsonObject buttonJson = convertToJson(button);
buttonArray.add(buttonJson);
}
@@ -42,7 +41,7 @@ public class WxMenuGsonAdapter implements JsonSerializer<WxMenu>, JsonDeserializ
return json;
}
protected JsonObject convertToJson(WxMenuButton button) {
protected JsonObject convertToJson(WxMenu.WxMenuButton button) {
JsonObject buttonJson = new JsonObject();
buttonJson.addProperty("type", button.getType());
buttonJson.addProperty("name", button.getName());
@@ -50,7 +49,7 @@ public class WxMenuGsonAdapter implements JsonSerializer<WxMenu>, JsonDeserializ
buttonJson.addProperty("url", button.getUrl());
if (button.getSub_button() != null && button.getSub_button().size() > 0) {
JsonArray buttonArray = new JsonArray();
for (WxMenuButton sub_button : button.getSub_button()) {
for (WxMenu.WxMenuButton sub_button : button.getSub_button()) {
buttonArray.add(convertToJson(sub_button));
}
buttonJson.add("sub_button", buttonArray);
@@ -69,7 +68,7 @@ public class WxMenuGsonAdapter implements JsonSerializer<WxMenu>, JsonDeserializ
JsonArray buttonsJson = menuJson.get("button").getAsJsonArray();
for (int i = 0; i < buttonsJson.size(); i++) {
JsonObject buttonJson = buttonsJson.get(i).getAsJsonObject();
WxMenuButton button = convertFromJson(buttonJson);
WxMenu.WxMenuButton button = convertFromJson(buttonJson);
menu.getButton().add(button);
if (buttonJson.get("sub_button") == null || buttonJson.get("sub_button").isJsonNull()) {
continue;
@@ -83,8 +82,8 @@ public class WxMenuGsonAdapter implements JsonSerializer<WxMenu>, JsonDeserializ
return menu;
}
protected WxMenuButton convertFromJson(JsonObject json) {
WxMenuButton button = new WxMenuButton();
protected WxMenu.WxMenuButton convertFromJson(JsonObject json) {
WxMenu.WxMenuButton button = new WxMenu.WxMenuButton();
button.setName(GsonHelper.getString(json, "name"));
button.setKey(GsonHelper.getString(json, "key"));
button.setUrl(GsonHelper.getString(json, "url"));

View File

@@ -6,11 +6,11 @@
* arose from modification of the original source, or other redistribution of this source
* is not permitted without written permission of the KINGSTAR MEDIA SOLUTIONS LTD.
*/
package chanjarster.weixin.util.json;
package me.chanjar.weixin.util.json;
import java.lang.reflect.Type;
import chanjarster.weixin.bean.result.WxUser;
import me.chanjar.weixin.bean.result.WxUser;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;

View File

@@ -6,11 +6,11 @@
* arose from modification of the original source, or other redistribution of this source
* is not permitted without written permission of the KINGSTAR MEDIA SOLUTIONS LTD.
*/
package chanjarster.weixin.util.json;
package me.chanjar.weixin.util.json;
import java.lang.reflect.Type;
import chanjarster.weixin.bean.result.WxUserList;
import me.chanjar.weixin.bean.result.WxUserList;
import com.google.gson.JsonArray;
import com.google.gson.JsonDeserializationContext;

View File

@@ -1,4 +1,4 @@
package chanjarster.weixin.util.xml;
package me.chanjar.weixin.util.xml;
import javax.xml.bind.annotation.adapters.XmlAdapter;

View File

@@ -1,4 +1,4 @@
package chanjarster.weixin.util.xml;
package me.chanjar.weixin.util.xml;
import javax.xml.bind.annotation.adapters.XmlAdapter;

View File

@@ -1,4 +1,4 @@
package chanjarster.weixin.util.xml;
package me.chanjar.weixin.util.xml;
import java.io.IOException;
import java.io.InputStream;

View File

@@ -1,4 +1,4 @@
package chanjarster.weixin.api;
package me.chanjar.weixin.api;
import java.io.InputStream;
@@ -7,7 +7,9 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import chanjarster.weixin.util.xml.XmlTransformer;
import me.chanjar.weixin.api.WxInMemoryConfigStorage;
import me.chanjar.weixin.api.WxServiceImpl;
import me.chanjar.weixin.util.xml.XmlTransformer;
import com.google.inject.Binder;
import com.google.inject.Module;

View File

@@ -1,11 +1,11 @@
package chanjarster.weixin.api;
package me.chanjar.weixin.api;
import org.apache.commons.lang3.StringUtils;
import org.testng.Assert;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
import chanjarster.weixin.exception.WxErrorException;
import me.chanjar.weixin.exception.WxErrorException;
import com.google.inject.Inject;

View File

@@ -1,11 +1,10 @@
package chanjarster.weixin.api;
package me.chanjar.weixin.api;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
import chanjarster.weixin.api.ApiTestModule.WxXmlConfigStorage;
import chanjarster.weixin.bean.WxCustomMessage;
import chanjarster.weixin.exception.WxErrorException;
import me.chanjar.weixin.bean.WxCustomMessage;
import me.chanjar.weixin.exception.WxErrorException;
import com.google.inject.Inject;
@@ -22,7 +21,7 @@ public class WxCustomMessageAPITest {
protected WxServiceImpl wxService;
public void testSendCustomMessage() throws WxErrorException {
WxXmlConfigStorage configStorage = (WxXmlConfigStorage) wxService.wxConfigStorage;
ApiTestModule.WxXmlConfigStorage configStorage = (ApiTestModule.WxXmlConfigStorage) wxService.wxConfigStorage;
WxCustomMessage message = new WxCustomMessage();
message.setMsgtype(WxConsts.CUSTOM_MSG_TEXT);
message.setTouser(configStorage.getOpenId());

View File

@@ -1,4 +1,4 @@
package chanjarster.weixin.api;
package me.chanjar.weixin.api;
import java.util.List;
@@ -6,8 +6,8 @@ import org.testng.Assert;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
import chanjarster.weixin.bean.WxGroup;
import chanjarster.weixin.exception.WxErrorException;
import me.chanjar.weixin.bean.WxGroup;
import me.chanjar.weixin.exception.WxErrorException;
import com.google.inject.Inject;

View File

@@ -1,4 +1,4 @@
package chanjarster.weixin.api;
package me.chanjar.weixin.api;
import java.io.IOException;
import java.io.InputStream;
@@ -8,16 +8,16 @@ import org.testng.annotations.DataProvider;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
import chanjarster.weixin.api.ApiTestModule.WxXmlConfigStorage;
import chanjarster.weixin.bean.WxMassGroupMessage;
import chanjarster.weixin.bean.WxMassNews;
import chanjarster.weixin.bean.WxMassNews.WxMassNewsArticle;
import chanjarster.weixin.bean.WxMassOpenIdsMessage;
import chanjarster.weixin.bean.WxMassVideo;
import chanjarster.weixin.bean.result.WxMassSendResult;
import chanjarster.weixin.bean.result.WxMassUploadResult;
import chanjarster.weixin.bean.result.WxMediaUploadResult;
import chanjarster.weixin.exception.WxErrorException;
import me.chanjar.weixin.api.ApiTestModule.WxXmlConfigStorage;
import me.chanjar.weixin.bean.WxMassGroupMessage;
import me.chanjar.weixin.bean.WxMassNews;
import me.chanjar.weixin.bean.WxMassNews.WxMassNewsArticle;
import me.chanjar.weixin.bean.WxMassOpenIdsMessage;
import me.chanjar.weixin.bean.WxMassVideo;
import me.chanjar.weixin.bean.result.WxMassSendResult;
import me.chanjar.weixin.bean.result.WxMassUploadResult;
import me.chanjar.weixin.bean.result.WxMediaUploadResult;
import me.chanjar.weixin.exception.WxErrorException;
import com.google.inject.Inject;

View File

@@ -1,4 +1,4 @@
package chanjarster.weixin.api;
package me.chanjar.weixin.api;
import java.io.IOException;
import java.io.InputStream;
@@ -10,8 +10,8 @@ import org.testng.annotations.DataProvider;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
import chanjarster.weixin.bean.result.WxMediaUploadResult;
import chanjarster.weixin.exception.WxErrorException;
import me.chanjar.weixin.bean.result.WxMediaUploadResult;
import me.chanjar.weixin.exception.WxErrorException;
import com.google.inject.Inject;

View File

@@ -1,4 +1,4 @@
package chanjarster.weixin.api;
package me.chanjar.weixin.api;
import javax.xml.bind.JAXBException;
@@ -9,9 +9,9 @@ import org.testng.annotations.Test;
import com.google.inject.Inject;
import chanjarster.weixin.bean.WxMenu;
import chanjarster.weixin.bean.WxMenu.WxMenuButton;
import chanjarster.weixin.exception.WxErrorException;
import me.chanjar.weixin.bean.WxMenu;
import me.chanjar.weixin.bean.WxMenu.WxMenuButton;
import me.chanjar.weixin.exception.WxErrorException;
/**
* 测试菜单

View File

@@ -1,13 +1,16 @@
package chanjarster.weixin.api;
package me.chanjar.weixin.api;
import java.util.Map;
import me.chanjar.weixin.api.WxConsts;
import me.chanjar.weixin.api.WxMessageHandler;
import me.chanjar.weixin.api.WxMessageRouter;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import chanjarster.weixin.bean.WxXmlMessage;
import chanjarster.weixin.bean.WxXmlOutMessage;
import me.chanjar.weixin.bean.WxXmlMessage;
import me.chanjar.weixin.bean.WxXmlOutMessage;
/**
* 测试消息路由器

View File

@@ -1,4 +1,4 @@
package chanjarster.weixin.api;
package me.chanjar.weixin.api;
import java.io.File;
@@ -6,8 +6,8 @@ import org.testng.Assert;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
import chanjarster.weixin.bean.result.WxQrCodeTicket;
import chanjarster.weixin.exception.WxErrorException;
import me.chanjar.weixin.bean.result.WxQrCodeTicket;
import me.chanjar.weixin.exception.WxErrorException;
import com.google.inject.Inject;

View File

@@ -1,10 +1,10 @@
package chanjarster.weixin.api;
package me.chanjar.weixin.api;
import org.testng.Assert;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
import chanjarster.weixin.exception.WxErrorException;
import me.chanjar.weixin.exception.WxErrorException;
import com.google.inject.Inject;

View File

@@ -1,13 +1,13 @@
package chanjarster.weixin.api;
package me.chanjar.weixin.api;
import org.testng.Assert;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
import chanjarster.weixin.api.ApiTestModule.WxXmlConfigStorage;
import chanjarster.weixin.bean.result.WxUser;
import chanjarster.weixin.bean.result.WxUserList;
import chanjarster.weixin.exception.WxErrorException;
import me.chanjar.weixin.api.ApiTestModule.WxXmlConfigStorage;
import me.chanjar.weixin.bean.result.WxUser;
import me.chanjar.weixin.bean.result.WxUserList;
import me.chanjar.weixin.exception.WxErrorException;
import com.google.inject.Inject;

View File

@@ -1,5 +1,6 @@
package chanjarster.weixin.bean;
package me.chanjar.weixin.bean;
import me.chanjar.weixin.bean.WxAccessToken;
import org.testng.Assert;
import org.testng.annotations.Test;

View File

@@ -1,10 +1,11 @@
package chanjarster.weixin.bean;
package me.chanjar.weixin.bean;
import me.chanjar.weixin.bean.WxCustomMessage;
import org.testng.Assert;
import org.testng.annotations.Test;
import chanjarster.weixin.api.WxConsts;
import chanjarster.weixin.bean.WxCustomMessage.WxArticle;
import me.chanjar.weixin.api.WxConsts;
import me.chanjar.weixin.bean.WxCustomMessage.WxArticle;
@Test
public class WxCustomMessageTest {

View File

@@ -1,9 +1,9 @@
package chanjarster.weixin.bean;
package me.chanjar.weixin.bean;
import org.testng.Assert;
import org.testng.annotations.Test;
import chanjarster.weixin.bean.result.WxError;
import me.chanjar.weixin.bean.result.WxError;
@Test
public class WxErrorTest {

View File

@@ -1,10 +1,11 @@
package chanjarster.weixin.bean;
package me.chanjar.weixin.bean;
import me.chanjar.weixin.bean.WxMenu;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import chanjarster.weixin.bean.WxMenu.WxMenuButton;
import me.chanjar.weixin.bean.WxMenu.WxMenuButton;
@Test
public class WxMenuTest {

View File

@@ -1,9 +1,10 @@
package chanjarster.weixin.bean;
package me.chanjar.weixin.bean;
import me.chanjar.weixin.bean.WxXmlMessage;
import org.testng.Assert;
import org.testng.annotations.Test;
import chanjarster.weixin.api.WxConsts;
import me.chanjar.weixin.api.WxConsts;
@Test
public class WxXmlMessageTest {

View File

@@ -1,5 +1,7 @@
package chanjarster.weixin.bean;
package me.chanjar.weixin.bean;
import me.chanjar.weixin.bean.WxXmlOutMessage;
import me.chanjar.weixin.bean.WxXmlOutMusicMessage;
import org.testng.Assert;
import org.testng.annotations.Test;

View File

@@ -1,5 +1,7 @@
package chanjarster.weixin.bean;
package me.chanjar.weixin.bean;
import me.chanjar.weixin.bean.WxXmlOutMessage;
import me.chanjar.weixin.bean.WxXmlOutMewsMessage;
import org.testng.Assert;
import org.testng.annotations.Test;

View File

@@ -1,5 +1,7 @@
package chanjarster.weixin.bean;
package me.chanjar.weixin.bean;
import me.chanjar.weixin.bean.WxXmlOutMessage;
import me.chanjar.weixin.bean.WxXmlOutVideoMessage;
import org.testng.Assert;
import org.testng.annotations.Test;

View File

@@ -1,5 +1,7 @@
package chanjarster.weixin.bean;
package me.chanjar.weixin.bean;
import me.chanjar.weixin.bean.WxXmlOutMessage;
import me.chanjar.weixin.bean.WxXmlOutVoiceMessage;
import org.testng.Assert;
import org.testng.annotations.Test;

View File

@@ -1,5 +1,7 @@
package chanjarster.weixin.bean;
package me.chanjar.weixin.bean;
import me.chanjar.weixin.bean.WxXmlOutImageMessage;
import me.chanjar.weixin.bean.WxXmlOutMessage;
import org.testng.Assert;
import org.testng.annotations.Test;

View File

@@ -1,5 +1,7 @@
package chanjarster.weixin.bean;
package me.chanjar.weixin.bean;
import me.chanjar.weixin.bean.WxXmlOutMessage;
import me.chanjar.weixin.bean.WxXmlOutTextMessage;
import org.testng.Assert;
import org.testng.annotations.Test;

View File

@@ -1,8 +1,8 @@
<xml>
<appId></appId>
<secret></secret>
<token></token>
<accessToken></accessToken>
<expiresIn></expiresIn>
<openId></openId>
<appId></appId>
<secret></secret>
<token></token>
<accessToken></accessToken>
<expiresIn></expiresIn>
<openId></openId>
</xml>

View File

@@ -3,32 +3,32 @@
<suite name="Weixin-java-tool-suite" verbose="1">
<test name="API_Test">
<classes>
<class name="chanjarster.weixin.api.WxBaseAPITest" />
<class name="chanjarster.weixin.api.WxCustomMessageAPITest" />
<class name="chanjarster.weixin.api.WxMenuAPITest" />
<class name="chanjarster.weixin.api.WxGroupAPITest" />
<class name="chanjarster.weixin.api.WxMassMessageAPITest" />
<class name="chanjarster.weixin.api.WxMediaAPITest" />
<class name="chanjarster.weixin.api.WxUserAPITest" />
<class name="chanjarster.weixin.api.WxQrCodeAPITest" />
<class name="chanjarster.weixin.api.WxShortUrlAPITest" />
<class name="chanjarster.weixin.api.WxMessageRouterTest" />
<class name="me.chanjar.weixin.api.WxBaseAPITest" />
<class name="me.chanjar.weixin.api.WxCustomMessageAPITest" />
<class name="me.chanjar.weixin.api.WxMenuAPITest" />
<class name="me.chanjar.weixin.api.WxGroupAPITest" />
<class name="me.chanjar.weixin.api.WxMassMessageAPITest" />
<class name="me.chanjar.weixin.api.WxMediaAPITest" />
<class name="me.chanjar.weixin.api.WxUserAPITest" />
<class name="me.chanjar.weixin.api.WxQrCodeAPITest" />
<class name="me.chanjar.weixin.api.WxShortUrlAPITest" />
<class name="me.chanjar.weixin.api.WxMessageRouterTest" />
</classes>
</test>
<test name="Bean_Test">
<classes>
<class name="chanjarster.weixin.bean.WxAccessTokenTest" />
<class name="chanjarster.weixin.bean.WxCustomMessageTest" />
<class name="chanjarster.weixin.bean.WxErrorTest" />
<class name="chanjarster.weixin.bean.WxMenuTest" />
<class name="chanjarster.weixin.bean.WxXmlMessageTest" />
<class name="chanjarster.weixin.bean.WxXmlOutImageMessageTest" />
<class name="chanjarster.weixin.bean.WxXmlOutIMusicMessageTest" />
<class name="chanjarster.weixin.bean.WxXmlOutINewsMessageTest" />
<class name="chanjarster.weixin.bean.WxXmlOutIVideoMessageTest" />
<class name="chanjarster.weixin.bean.WxXmlOutIVoiceMessageTest" />
<class name="chanjarster.weixin.bean.WxXmlOutTextMessageTest" />
<class name="me.chanjar.weixin.bean.WxAccessTokenTest" />
<class name="me.chanjar.weixin.bean.WxCustomMessageTest" />
<class name="me.chanjar.weixin.bean.WxErrorTest" />
<class name="me.chanjar.weixin.bean.WxMenuTest" />
<class name="me.chanjar.weixin.bean.WxXmlMessageTest" />
<class name="me.chanjar.weixin.bean.WxXmlOutImageMessageTest" />
<class name="me.chanjar.weixin.bean.WxXmlOutIMusicMessageTest" />
<class name="me.chanjar.weixin.bean.WxXmlOutINewsMessageTest" />
<class name="me.chanjar.weixin.bean.WxXmlOutIVideoMessageTest" />
<class name="me.chanjar.weixin.bean.WxXmlOutIVoiceMessageTest" />
<class name="me.chanjar.weixin.bean.WxXmlOutTextMessageTest" />
</classes>
</test>
</suite>