项目重构

This commit is contained in:
yu199195 2018-03-01 16:42:27 +08:00
parent b7d35df723
commit acb810f96a
298 changed files with 7520 additions and 3940 deletions

View File

@ -1,46 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.admin.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* <p>Description: .</p>
*
* @author xiaoyu(Myth)
* @version 1.0
* @date 2017/10/23 20:10
* @since JDK 1.8
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface Permission {
/**
* 是否登录
*
* @return true 需要 false 不需要
*/
boolean isLogin() default true;
}

View File

@ -1,46 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.admin.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* <p>Description: .</p>
*
* @author xiaoyu(Myth)
* @version 1.0
* @date 2017/10/24 16:24
* @since JDK 1.8
*/
@Data
public class CompensationDTO implements Serializable {
private static final long serialVersionUID = 6905402148490426011L;
private String applicationName;
private List<String> ids;
private String id;
private Integer retry;
}

View File

@ -1,41 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.admin.dto;
import lombok.Data;
import java.io.Serializable;
/**
* <p>Description: .</p>
*
* @author xiaoyu(Myth)
* @version 1.0
* @date 2017/10/23 18:18
* @since JDK 1.8
*/
@Data
public class UserDTO implements Serializable {
private static final long serialVersionUID = -3479973014221253748L;
private String userName;
private String password;
}

View File

@ -1,51 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.admin.helper;
import com.happylifeplat.tcc.admin.vo.TccCompensationVO;
import com.happylifeplat.tcc.common.bean.adapter.CoordinatorRepositoryAdapter;
import com.happylifeplat.tcc.common.utils.DateUtils;
/**
* <p>Description: .</p>
*
* @author xiaoyu(Myth)
* @version 1.0
* @date 2017/10/23 11:53
* @since JDK 1.8
*/
public class ConvertHelper {
public static TccCompensationVO buildVO(CoordinatorRepositoryAdapter adapter) {
TccCompensationVO vo = new TccCompensationVO();
vo.setTransId(adapter.getTransId());
vo.setCreateTime(DateUtils.parseDate(adapter.getCreateTime()));
vo.setRetriedCount(adapter.getRetriedCount());
vo.setLastTime(DateUtils.parseDate(adapter.getLastTime()));
vo.setVersion(adapter.getVersion());
vo.setTargetClass(adapter.getTargetClass());
vo.setTargetMethod(adapter.getTargetMethod());
vo.setConfirmMethod(adapter.getConfirmMethod());
vo.setCancelMethod(adapter.getCancelMethod());
return vo;
}
}

View File

@ -1,40 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.admin.service;
import java.util.List;
/**
* <p>Description: .</p>
*
* @author xiaoyu(Myth)
* @version 1.0
* @date 2017/10/20 16:34
* @since JDK 1.8
*/
public interface ApplicationNameService {
/**
* 获取之前参与分布式事务项目的应用名称
*
* @return List<String>
*/
List<String> list();
}

View File

@ -1,66 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.admin.service;
import com.happylifeplat.tcc.admin.page.CommonPager;
import com.happylifeplat.tcc.admin.query.CompensationQuery;
import com.happylifeplat.tcc.admin.vo.TccCompensationVO;
import java.util.List;
/**
* <p>Description: .</p>
*
* @author xiaoyu(Myth)
* @version 1.0
* @date 2017/10/19 16:36
* @since JDK 1.8
*/
public interface CompensationService {
/**
* 分页获取补偿事务信息
*
* @param query 查询条件
* @return CommonPager<TransactionRecoverVO>
*/
CommonPager<TccCompensationVO> listByPage(CompensationQuery query);
/**
* 批量删除补偿事务信息
*
* @param ids ids 事务id集合
* @param applicationName 应用名称
* @return true 成功
*/
Boolean batchRemove(List<String> ids, String applicationName);
/**
* 更改恢复次数
*
* @param id 事务id
* @param retry 恢复次数
* @param applicationName 应用名称
* @return true 成功
*/
Boolean updateRetry(String id, Integer retry, String applicationName);
}

View File

@ -1,45 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.admin.service;
/**
* <p>Description: .</p>
*
* @author xiaoyu(Myth)
* @version 1.0
* @date 2017/10/20 10:17
* @since JDK 1.8
*/
public interface LoginService {
/**
* 登录接口验证用户名 密码
* @param userName 用户名
* @param password 密码
* @return true 成功
*/
Boolean login(String userName,String password);
/**
* 用户登出
* @return true 成功
*/
Boolean logout();
}

View File

@ -1,52 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.admin.service.compensate;
import com.google.common.base.Splitter;
import com.happylifeplat.tcc.admin.service.ApplicationNameService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>Description: .</p>
*
* @author xiaoyu(Myth)
* @version 1.0
* @date 2017/10/20 16:39
* @since JDK 1.8
*/
@Service("recoverApplicationNameService")
public class ApplicationNameServiceImpl implements ApplicationNameService {
@Value("${tcc.application.list}")
private String appNameList;
/**
* 获取之前参与分布式事务项目的应用名称
*
* @return List<String>
*/
@Override
public List<String> list() {
return Splitter.on(",").splitToList(appNameList);
}
}

View File

@ -1,4 +0,0 @@
com.happylifeplat.tcc.common.serializer.KryoSerializer
com.happylifeplat.tcc.common.serializer.ProtostuffSerializer
com.happylifeplat.tcc.common.serializer.HessianSerializer
com.happylifeplat.tcc.common.serializer.JavaSerializer

View File

@ -1,66 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.admin.service.compensate;
import com.happylifeplat.tcc.admin.page.CommonPager;
import com.happylifeplat.tcc.admin.page.PageParameter;
import com.happylifeplat.tcc.admin.service.CompensationService;
import com.happylifeplat.tcc.admin.query.CompensationQuery;
import com.happylifeplat.tcc.admin.vo.TccCompensationVO;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
/**
* <p>Description:</p>
*
* @author xiaoyu(Myth)
* @version 1.0
* @date 2017/10/20 16:01
* @since JDK 1.8
*/
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class MongoCompensationServiceImplTest {
@Autowired
private CompensationService compensationService;
@Test
public void listByPage() throws Exception {
CompensationQuery query = new CompensationQuery();
query.setApplicationName("alipay-service");
PageParameter pageParameter = new PageParameter(1,5);
query.setPageParameter(pageParameter);
final CommonPager<TccCompensationVO> voCommonPager = compensationService.listByPage(query);
}
}

View File

@ -1,67 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.admin.service.compensate;
import com.happylifeplat.tcc.admin.page.CommonPager;
import com.happylifeplat.tcc.admin.page.PageParameter;
import com.happylifeplat.tcc.admin.query.CompensationQuery;
import com.happylifeplat.tcc.admin.service.CompensationService;
import com.happylifeplat.tcc.admin.vo.TccCompensationVO;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
/**
* <p>Description:</p>
*
* @author xiaoyu(Myth)
* @version 1.0
* @date 2017/10/20 16:01
* @since JDK 1.8
*/
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class RedisCompensationServiceImplTest {
@Autowired
private CompensationService compensationService;
@Test
public void listByPage() throws Exception {
CompensationQuery query = new CompensationQuery();
query.setApplicationName("alipay-service");
PageParameter pageParameter = new PageParameter(1,1);
query.setPageParameter(pageParameter);
query.setRetry(2);
query.setTransId("2075304338");
final CommonPager<TccCompensationVO> voCommonPager = compensationService.listByPage(query);
}
}

View File

@ -1,66 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.admin.service.compensate;
import com.happylifeplat.tcc.admin.page.CommonPager;
import com.happylifeplat.tcc.admin.page.PageParameter;
import com.happylifeplat.tcc.admin.service.CompensationService;
import com.happylifeplat.tcc.admin.query.CompensationQuery;
import com.happylifeplat.tcc.admin.vo.TccCompensationVO;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
/**
* <p>Description:</p>
*
* @author xiaoyu(Myth)
* @version 1.0
* @date 2017/10/20 16:01
* @since JDK 1.8
*/
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class ZookeeperCompensationServiceImplTest {
@Autowired
private CompensationService compensationService;
@Test
public void listByPage() throws Exception {
CompensationQuery query = new CompensationQuery();
query.setApplicationName("alipay-service");
PageParameter pageParameter = new PageParameter(1,8);
query.setPageParameter(pageParameter);
final CommonPager<TccCompensationVO> voCommonPager = compensationService.listByPage(query);
}
}

View File

@ -1,46 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~
~ Copyright 2017-2018 549477611@qq.com(xiaoyu)
~
~ This copyrighted material is made available to anyone wishing to use, modify,
~ copy, or redistribute it subject to the terms and conditions of the GNU
~ Lesser General Public License, as published by the Free Software Foundation.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
~ for more details.
~
~ You should have received a copy of the GNU Lesser General Public License
~ along with this distribution; if not, see <http://www.gnu.org/licenses/>.
~
-->
<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">
<parent>
<artifactId>happylifeplat-tcc</artifactId>
<groupId>com.happylifeplat.tcc</groupId>
<version>1.1.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>happylifeplat-tcc-annotation</artifactId>
<build>
<finalName>happylifeplat-tcc-annotation</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,58 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.common.bean.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Arrays;
/**
* @author xiaoyu
*/
@Data
@AllArgsConstructor
public class TccInvocation implements Serializable {
private static final long serialVersionUID = -5108578223428529356L;
@Getter
private Class targetClass;
@Getter
private String methodName;
@Getter
private Class[] parameterTypes;
@Getter
private Object[] args;
public TccInvocation(){
}
}

View File

@ -1,34 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.common.config;
import lombok.Data;
/**
* @author xiaoyu
*/
@Data
public class TccZookeeperConfig {
private String host;
private int sessionTimeOut = 1000;
private String rootPath = "/tcc";
}

View File

@ -1,44 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.common.constant;
/**
* @author xiaoyu
*/
public interface CommonConstant {
String DB_MYSQL = "mysql";
String DB_SQLSERVER = "sqlserver";
String DB_ORACLE = "oracle";
String PATH_SUFFIX = "/tcc";
String DB_SUFFIX = "tcc_";
String RECOVER_REDIS_KEY_PRE="tcc:transaction:%s";
String TCC_TRANSACTION_CONTEXT = "TCC_TRANSACTION_CONTEXT";
}

View File

@ -1,55 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.common.serializer;
import com.happylifeplat.tcc.common.exception.TccException;
/**
* @author xiaoyu
*/
public interface ObjectSerializer {
/**
* 序列化对象
*
* @param obj 需要序更列化的对象
* @return byte []
* @throws TccException 异常信息
*/
byte[] serialize(Object obj) throws TccException;
/**
* 反序列化对象
*
* @param param 需要反序列化的byte []
* @param clazz java对象
* @param <T> 泛型支持
* @return 对象
* @throws TccException 异常信息
*/
<T> T deSerialize(byte[] param, Class<T> clazz) throws TccException;
/**
* 设置scheme
*
* @return scheme 命名
*/
String getScheme();
}

View File

@ -1,51 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.common.utils;
import com.happylifeplat.tcc.common.exception.TccRuntimeException;
/**
* @author xiaoyu
*/
public class AssertUtils {
private AssertUtils() {
}
public static void notNull(Object obj, String message) {
if (obj == null) {
throw new TccRuntimeException(message);
}
}
public static void notNull(Object obj) {
if (obj == null) {
throw new TccRuntimeException("argument invalid,Please check");
}
}
public static void checkConditionArgument(boolean condition, String message) {
if (!condition) {
throw new TccRuntimeException(message);
}
}
}

View File

@ -1,47 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.common.utils;
import com.happylifeplat.tcc.common.constant.CommonConstant;
/**
* <p>Description: .</p>
*
* @author xiaoyu(Myth)
* @version 1.0
* @date 2017/10/20 11:39
* @since JDK 1.8
*/
public class DbTypeUtils {
public static String buildByDriverClassName(String driverClassName) {
String dbType = "mysql";
if (driverClassName.contains(CommonConstant.DB_MYSQL)) {
dbType = "mysql";
} else if (driverClassName.contains(CommonConstant.DB_SQLSERVER)) {
dbType = "sqlserver";
} else if (driverClassName.contains(CommonConstant.DB_ORACLE)) {
dbType = "oracle";
}
return dbType;
}
}

View File

@ -1,43 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.common.utils;
import com.google.gson.Gson;
/**
* @author xiaoyu
*/
public class GsonUtils {
private static final GsonUtils GSON_UTILS = new GsonUtils();
private static final Gson GSON = new Gson();
public static GsonUtils getInstance() {
return GSON_UTILS;
}
public String toJson(Object object) {
return GSON.toJson(object);
}
public <T> T fromJson(String json, Class<T> tClass) {
return GSON.fromJson(json, tClass);
}
}

View File

@ -1,44 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.common.utils;
import java.util.Iterator;
import java.util.ServiceLoader;
/**
* @author xiaoyu
*/
public class ServiceBootstrap {
public static <S> S loadFirst(Class<S> clazz) {
final ServiceLoader<S> loader = loadAll(clazz);
final Iterator<S> iterator = loader.iterator();
if (!iterator.hasNext()) {
throw new IllegalStateException(String.format(
"No implementation defined in /META-INF/services/%s, please check whether the file exists and has the right implementation class!",
clazz.getName()));
}
return iterator.next();
}
public static <S> ServiceLoader<S> loadAll(Class<S> clazz) {
return ServiceLoader.load(clazz);
}
}

View File

@ -1,51 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.core.concurrent.threadlocal;
/**
* @author xiaoyu
*/
public class CoordinatorLocal {
private static final CoordinatorLocal COMPENSATION_LOCAL = new CoordinatorLocal();
private CoordinatorLocal() {
}
public static CoordinatorLocal getInstance() {
return COMPENSATION_LOCAL;
}
private static final ThreadLocal<String> CURRENT_LOCAL = new ThreadLocal<>();
public void set(String coordinatorId) {
CURRENT_LOCAL.set(coordinatorId);
}
public String get() {
return CURRENT_LOCAL.get();
}
public void remove() {
CURRENT_LOCAL.remove();
}
}

View File

@ -1,53 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.core.concurrent.threadlocal;
import com.happylifeplat.tcc.common.bean.context.TccTransactionContext;
/**
* @author xiaoyu
*/
public class TransactionContextLocal {
private static final ThreadLocal<TccTransactionContext> CURRENT_LOCAL = new ThreadLocal<>();
private static final TransactionContextLocal TRANSACTION_CONTEXT_LOCAL = new TransactionContextLocal();
private TransactionContextLocal() {
}
public static TransactionContextLocal getInstance() {
return TRANSACTION_CONTEXT_LOCAL;
}
public void set(TccTransactionContext context) {
CURRENT_LOCAL.set(context);
}
public TccTransactionContext get() {
return CURRENT_LOCAL.get();
}
public void remove() {
CURRENT_LOCAL.remove();
}
}

View File

@ -1,50 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.core.concurrent.threadpool.policy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.concurrent.ThreadPoolExecutor;
/**
* @author xiaoyu
*/
public class CallerRunsPolicy extends ThreadPoolExecutor.CallerRunsPolicy {
private static final Logger LOG = LoggerFactory.getLogger(CallerRunsPolicy.class);
private String threadName;
public CallerRunsPolicy() {
this(null);
}
public CallerRunsPolicy(String threadName) {
this.threadName = threadName;
}
@Override
public void rejectedExecution(Runnable runnable, ThreadPoolExecutor executor) {
if (threadName != null) {
LOG.error("tccTransaction Thread pool [{}] is exhausted, executor={}", threadName, executor.toString());
}
super.rejectedExecution(runnable, executor);
}
}

View File

@ -1,29 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.core.concurrent.threadpool.policy;
/**
* @author xiaoyu
*/
public interface RejectedRunnable extends Runnable {
/**
* 线程池拒绝操作
*/
void rejected();
}

View File

@ -1,35 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.core.coordinator.command;
/**
* @author xiaoyu
*/
public interface Command {
/**
* 执行协调命令接口
*
* @param coordinatorAction 协调数据
*/
void execute(CoordinatorAction coordinatorAction);
}

View File

@ -1,60 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.core.coordinator.command;
import com.happylifeplat.tcc.common.enums.CoordinatorActionEnum;
import com.happylifeplat.tcc.common.bean.entity.TccTransaction;
import java.io.Serializable;
/**
* @author xiaoyu
*/
public class CoordinatorAction implements Serializable {
private static final long serialVersionUID = -5714963272234819587L;
private CoordinatorActionEnum action;
private TccTransaction tccTransaction;
public CoordinatorAction(CoordinatorActionEnum action, TccTransaction tccTransaction) {
this.action = action;
this.tccTransaction = tccTransaction;
}
public CoordinatorActionEnum getAction() {
return action;
}
public void setAction(CoordinatorActionEnum action) {
this.action = action;
}
public TccTransaction getTccTransaction() {
return tccTransaction;
}
public void setTccTransaction(TccTransaction tccTransaction) {
this.tccTransaction = tccTransaction;
}
}

View File

@ -1,52 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.core.coordinator.command;
import com.happylifeplat.tcc.core.coordinator.CoordinatorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* @author xiaoyu
*/
@Component
public class CoordinatorCommand implements Command {
private final CoordinatorService coordinatorService;
@Autowired
public CoordinatorCommand(CoordinatorService coordinatorService) {
this.coordinatorService = coordinatorService;
}
/**
* 执行协调命令接口
*
* @param coordinatorAction 协调数据
*/
@Override
public void execute(CoordinatorAction coordinatorAction) {
coordinatorService.submit(coordinatorAction);
}
}

View File

@ -1,35 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.core.helper;
import java.nio.ByteBuffer;
/**
* @author xiaoyu
*/
public class ByteUtils {
public static byte[] longToBytes(long l) {
return ByteBuffer.allocate(8).putLong(l).array();
}
public static long bytesToLong(byte[] bytes) {
return ByteBuffer.wrap(bytes).getLong();
}
}

View File

@ -1,36 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.core.helper;
import redis.clients.jedis.Jedis;
/**
* @author xiaoyu
*/
@FunctionalInterface
public interface JedisCallback<T> {
/**
* redis操作
*
* @param jedis jedis客户端
* @return T 泛型
*/
T doInJedis(Jedis jedis);
}

View File

@ -1,38 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.core.interceptor;
import org.aspectj.lang.ProceedingJoinPoint;
/**
* @author xiaoyu
*/
@FunctionalInterface
public interface TccTransactionInterceptor {
/**
* tcc分布式事务拦截方法
*
* @param pjp tcc切入点
* @return Object
* @throws Throwable 异常
*/
Object interceptor(ProceedingJoinPoint pjp) throws Throwable;
}

View File

@ -1,32 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.core.service;
/**
* @author xiaoyu
*/
public interface ApplicationService {
/**
* 获取applicationName
*
* @return applicationName
*/
String acquireName();
}

View File

@ -1,38 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.core.service;
import com.happylifeplat.tcc.common.bean.entity.Participant;
import java.util.List;
/**
* @author xiaoyu
*/
public interface RollbackService {
/**
* 执行协调回滚方法
*
* @param participantList 需要协调的资源集合
*/
void execute(List<Participant> participantList);
}

View File

@ -1,35 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.core.service;
import com.happylifeplat.tcc.common.config.TccConfig;
/**
* @author xiaoyu
*/
@FunctionalInterface
public interface TccInitService {
/**
* tcc分布式事务初始化方法
*
* @param tccConfig TCC配置
*/
void initialization(TccConfig tccConfig);
}

View File

@ -1,39 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.core.service;
import com.happylifeplat.tcc.common.bean.context.TccTransactionContext;
import org.aspectj.lang.ProceedingJoinPoint;
/**
* @author xiaoyu
*/
@FunctionalInterface
public interface TccTransactionAspectService {
/**
* tcc 事务切面服务
*
* @param tccTransactionContext tcc事务上下文对象
* @param point 切点
* @return object
* @throws Throwable 异常信息
*/
Object invoke(TccTransactionContext tccTransactionContext, ProceedingJoinPoint point) throws Throwable;
}

View File

@ -1,37 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.core.service;
import com.happylifeplat.tcc.common.bean.context.TccTransactionContext;
/**
* @author xiaoyu
*/
@FunctionalInterface
public interface TccTransactionFactoryService<T> {
/**
* 返回 实现TxTransactionHandler类的名称
*
* @param context
* @return Class<T>
* @throws Throwable 抛出异常
*/
Class<T> factoryOf(TccTransactionContext context) throws Throwable;
}

View File

@ -1,38 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.core.service;
import com.happylifeplat.tcc.common.bean.context.TccTransactionContext;
import org.aspectj.lang.ProceedingJoinPoint;
/**
* @author xiaoyu
*/
@FunctionalInterface
public interface TccTransactionHandler {
/**
* 分布式事务处理接口
*
* @param point point 切点
* @param tccTransactionContext tcc事务上下文
* @return Object
* @throws Throwable 异常
*/
Object handler(ProceedingJoinPoint point, TccTransactionContext tccTransactionContext) throws Throwable;
}

View File

@ -1,45 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.core.service.handler;
import com.happylifeplat.tcc.common.bean.context.TccTransactionContext;
import com.happylifeplat.tcc.core.service.TccTransactionHandler;
import org.aspectj.lang.ProceedingJoinPoint;
import org.springframework.stereotype.Component;
/**
* @author xiaoyu
*/
@Component
public class ConsumeTccTransactionHandler implements TccTransactionHandler {
/**
* 分布式事务处理接口
*
* @param point point 切点
* @param context 信息
* @return Object
* @throws Throwable 异常
*/
@Override
public Object handler(ProceedingJoinPoint point, TccTransactionContext context) throws Throwable {
return point.proceed();
}
}

View File

@ -1,115 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.core.service.impl;
import com.happylifeplat.tcc.common.config.TccConfig;
import com.happylifeplat.tcc.common.enums.RepositorySupportEnum;
import com.happylifeplat.tcc.common.enums.SerializeEnum;
import com.happylifeplat.tcc.common.utils.LogUtil;
import com.happylifeplat.tcc.core.coordinator.CoordinatorService;
import com.happylifeplat.tcc.core.helper.SpringBeanUtils;
import com.happylifeplat.tcc.core.service.TccInitService;
import com.happylifeplat.tcc.core.spi.CoordinatorRepository;
import com.happylifeplat.tcc.common.serializer.ObjectSerializer;
import com.happylifeplat.tcc.common.utils.ServiceBootstrap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Objects;
import java.util.Optional;
import java.util.ServiceLoader;
import java.util.stream.StreamSupport;
/**
* @author xiaoyu
*/
@Service("tccInitService")
public class TccInitServiceImpl implements TccInitService {
/**
* logger
*/
private static final Logger LOGGER = LoggerFactory.getLogger(TccInitServiceImpl.class);
private final CoordinatorService coordinatorService;
@Autowired
public TccInitServiceImpl(CoordinatorService coordinatorService) {
this.coordinatorService = coordinatorService;
}
/**
* tcc分布式事务初始化方法
*
* @param tccConfig TCC配置
*/
@Override
public void initialization(TccConfig tccConfig) {
Runtime.getRuntime().addShutdownHook(new Thread(() -> LOGGER.error("系统关闭")));
try {
loadSpiSupport(tccConfig);
coordinatorService.start(tccConfig);
} catch (Exception ex) {
LogUtil.error(LOGGER, "tcc事务初始化异常:{}", ex::getMessage);
//非正常关闭
System.exit(1);
}
LogUtil.info(LOGGER, () -> "Tcc事务初始化成功");
}
/**
* 根据配置文件初始化spi
*
* @param tccConfig 配置信息
*/
private void loadSpiSupport(TccConfig tccConfig) {
//spi serialize
final SerializeEnum serializeEnum =
SerializeEnum.acquire(tccConfig.getSerializer());
final ServiceLoader<ObjectSerializer> objectSerializers = ServiceBootstrap.loadAll(ObjectSerializer.class);
final Optional<ObjectSerializer> serializer = StreamSupport.stream(objectSerializers.spliterator(), false)
.filter(objectSerializer ->
Objects.equals(objectSerializer.getScheme(), serializeEnum.getSerialize())).findFirst();
//spi repository support
final RepositorySupportEnum repositorySupportEnum = RepositorySupportEnum.acquire(tccConfig.getRepositorySupport());
final ServiceLoader<CoordinatorRepository> recoverRepositories = ServiceBootstrap.loadAll(CoordinatorRepository.class);
final Optional<CoordinatorRepository> repositoryOptional = StreamSupport.stream(recoverRepositories.spliterator(), false)
.filter(recoverRepository ->
Objects.equals(recoverRepository.getScheme(), repositorySupportEnum.getSupport())).findFirst();
//将CoordinatorRepository实现注入到spring容器
repositoryOptional.ifPresent(repository -> {
serializer.ifPresent(repository::setSerializer);
SpringBeanUtils.getInstance().registerBean(CoordinatorRepository.class.getName(), repository);
});
}
}

View File

@ -1,40 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.core.spring;
import org.springframework.beans.factory.config.BeanDefinitionHolder;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.context.annotation.ClassPathBeanDefinitionScanner;
import java.util.Set;
/**
* @author xiaoyu
*/
public class TccScanner extends ClassPathBeanDefinitionScanner {
public TccScanner(BeanDefinitionRegistry registry) {
super(registry);
}
@Override
protected Set<BeanDefinitionHolder> doScan(String... basePackages) {
return super.doScan(basePackages);
}
}

View File

@ -1,4 +0,0 @@
com.happylifeplat.tcc.common.serializer.KryoSerializer
com.happylifeplat.tcc.common.serializer.ProtostuffSerializer
com.happylifeplat.tcc.common.serializer.HessianSerializer
com.happylifeplat.tcc.common.serializer.JavaSerializer

View File

@ -1,5 +0,0 @@
com.happylifeplat.tcc.core.spi.repository.JdbcCoordinatorRepository
com.happylifeplat.tcc.core.spi.repository.FileCoordinatorRepository
com.happylifeplat.tcc.core.spi.repository.MongoCoordinatorRepository
com.happylifeplat.tcc.core.spi.repository.RedisCoordinatorRepository
com.happylifeplat.tcc.core.spi.repository.ZookeeperCoordinatorRepository

View File

@ -1,5 +0,0 @@
com.happylifeplat.tcc.core.spi.repository.JdbcCoordinatorRepository
com.happylifeplat.tcc.core.spi.repository.FileCoordinatorRepository
com.happylifeplat.tcc.core.spi.repository.MongoCoordinatorRepository
com.happylifeplat.tcc.core.spi.repository.RedisCoordinatorRepository
com.happylifeplat.tcc.core.spi.repository.ZookeeperCoordinatorRepository

View File

@ -1,46 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.dubbo.interceptor;
import com.happylifeplat.tcc.core.interceptor.AbstractTccTransactionAspect;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Component;
/**
* @author xiaoyu
*/
@Aspect
@Component
public class DubboTccTransactionAspect extends AbstractTccTransactionAspect implements Ordered {
@Autowired
public DubboTccTransactionAspect(DubboTccTransactionInterceptor dubboTccTransactionInterceptor) {
super.setTccTransactionInterceptor(dubboTccTransactionInterceptor);
}
@Override
public int getOrder() {
return Ordered.HIGHEST_PRECEDENCE;
}
}

View File

@ -1,48 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.dubbo.service;
import com.alibaba.dubbo.config.ApplicationConfig;
import com.happylifeplat.tcc.core.service.ApplicationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author xiaoyu
*/
@Service("applicationService")
public class DubboApplicationServiceImpl implements ApplicationService {
/**
* dubbo ApplicationConfig
*/
private final ApplicationConfig applicationConfig;
@Autowired(required = false)
public DubboApplicationServiceImpl(ApplicationConfig applicationConfig) {
this.applicationConfig = applicationConfig;
}
@Override
public String acquireName() {
return applicationConfig.getName();
}
}

View File

@ -1,2 +0,0 @@
TxTransactionFilter=com.happylifeplat.tcc.dubbo.filter.TccTransactionFilter

View File

@ -1,46 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.motan.interceptor;
import com.happylifeplat.tcc.core.interceptor.AbstractTccTransactionAspect;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Component;
/**
* @author xiaoyu
*/
@Aspect
@Component
public class MotanTccTransactionAspect extends AbstractTccTransactionAspect implements Ordered {
@Autowired
public MotanTccTransactionAspect(MotanTccTransactionInterceptor motanTccTransactionInterceptor) {
super.setTccTransactionInterceptor(motanTccTransactionInterceptor);
}
@Override
public int getOrder() {
return Ordered.HIGHEST_PRECEDENCE;
}
}

View File

@ -1,50 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.motan.service;
import com.happylifeplat.tcc.core.service.ApplicationService;
import com.weibo.api.motan.config.springsupport.BasicServiceConfigBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author xiaoyu
*/
@Service
public class MotanApplicationServiceImpl implements ApplicationService {
private final BasicServiceConfigBean basicServiceConfigBean;
@Autowired
public MotanApplicationServiceImpl(BasicServiceConfigBean basicServiceConfigBean) {
this.basicServiceConfigBean = basicServiceConfigBean;
}
/**
* 获取applicationName
*
* @return applicationName
*/
@Override
public String acquireName() {
return basicServiceConfigBean.getModule();
}
}

View File

@ -1 +0,0 @@
com.happylifeplat.tcc.motan.filter.MotanTccTransactionFilter

View File

@ -1,45 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.springcloud.feign;
import com.happylifeplat.tcc.common.constant.CommonConstant;
import com.happylifeplat.tcc.common.utils.GsonUtils;
import com.happylifeplat.tcc.common.bean.context.TccTransactionContext;
import com.happylifeplat.tcc.core.concurrent.threadlocal.TransactionContextLocal;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.context.annotation.Configuration;
/**
* @author xiaoyu
*/
@Configuration
public class TccRestTemplateInterceptor implements RequestInterceptor {
@Override
public void apply(RequestTemplate requestTemplate) {
final TccTransactionContext tccTransactionContext =
TransactionContextLocal.getInstance().get();
requestTemplate.header(CommonConstant.TCC_TRANSACTION_CONTEXT,
GsonUtils.getInstance().toJson(tccTransactionContext));
}
}

View File

@ -1,48 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.springcloud.interceptor;
import com.happylifeplat.tcc.core.interceptor.AbstractTccTransactionAspect;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Component;
/**
* @author xiaoyu
*/
@Aspect
@Component
public class SpringCloudTxTransactionAspect extends AbstractTccTransactionAspect implements Ordered {
@Autowired
public SpringCloudTxTransactionAspect(SpringCloudTxTransactionInterceptor springCloudTxTransactionInterceptor) {
this.setTccTransactionInterceptor(springCloudTxTransactionInterceptor);
}
public void init() {
}
@Override
public int getOrder() {
return Ordered.HIGHEST_PRECEDENCE;
}
}

View File

@ -1,38 +0,0 @@
/*
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
*
*/
package com.happylifeplat.tcc.springcloud.service;
import com.happylifeplat.tcc.core.service.ApplicationService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
/**
* @author xiaoyu
*/
@Service("applicationService")
public class SpringCloudApplicationServiceImpl implements ApplicationService {
@Value("${spring.application.name}")
private String appName;
@Override
public String acquireName() {
return appName;
}
}

@ -1 +0,0 @@
Subproject commit f98c3254b8072ede2d8fa19a931d1d10910a6490

View File

@ -1,39 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~
~ Copyright 2017-2018 549477611@qq.com(xiaoyu)
~
~ This copyrighted material is made available to anyone wishing to use, modify,
~ copy, or redistribute it subject to the terms and conditions of the GNU
~ Lesser General Public License, as published by the Free Software Foundation.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
~ for more details.
~
~ You should have received a copy of the GNU Lesser General Public License
~ along with this distribution; if not, see <http://www.gnu.org/licenses/>.
~
-->
<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">
<parent>
<artifactId>happylifeplat-tcc</artifactId>
<groupId>com.happylifeplat.tcc</groupId>
<artifactId>hmily-tcc</artifactId>
<groupId>com.hmily.tcc</groupId>
<version>1.1.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>happylifeplat-tcc-admin</artifactId>
<artifactId>hmily-tcc-admin</artifactId>
<dependencies>
<dependency>
<groupId>com.happylifeplat.tcc</groupId>
<artifactId>happylifeplat-tcc-common</artifactId>
<groupId>com.hmily.tcc</groupId>
<artifactId>hmily-tcc-common</artifactId>
</dependency>
<!--spring boot的核心启动器-->
@ -174,7 +158,7 @@
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.happylifeplat.tcc.admin.AdminApplication</mainClass>
<mainClass>com.hmily.tcc.admin.AdminApplication</mainClass>
<executable>true</executable>
</configuration>
</plugin>

View File

@ -0,0 +1,36 @@
/*
* 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 com.hmily.tcc.admin;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
/**
* @author xiaoyu
*/
@SpringBootApplication(exclude = {MongoAutoConfiguration.class, MongoDataAutoConfiguration.class})
public class AdminApplication {
public static void main(String[] args) {
SpringApplication.run(AdminApplication.class, args);
}
}

View File

@ -0,0 +1,44 @@
/*
* 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 com.hmily.tcc.admin.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* <p>Description: .</p>
*
* @author xiaoyu(Myth)
* @version 1.0
* @date 2017/10/23 20:10
* @since JDK 1.8
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface Permission {
/**
* 是否登录
*
* @return true 需要 false 不需要
*/
boolean isLogin() default true;
}

View File

@ -1,27 +1,26 @@
/*
* 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
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
* 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 com.happylifeplat.tcc.admin.configuration;
package com.hmily.tcc.admin.configuration;
import com.happylifeplat.tcc.admin.interceptor.AuthInterceptor;
import com.happylifeplat.tcc.common.enums.SerializeEnum;
import com.happylifeplat.tcc.common.serializer.KryoSerializer;
import com.happylifeplat.tcc.common.serializer.ObjectSerializer;
import com.happylifeplat.tcc.common.utils.ServiceBootstrap;
import com.hmily.tcc.admin.interceptor.AuthInterceptor;
import com.hmily.tcc.common.enums.SerializeEnum;
import com.hmily.tcc.common.serializer.KryoSerializer;
import com.hmily.tcc.common.serializer.ObjectSerializer;
import com.hmily.tcc.common.utils.ServiceBootstrap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

View File

@ -0,0 +1,70 @@
/*
* 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 com.hmily.tcc.admin.configuration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.builders.ResponseMessageBuilder;
import springfox.documentation.schema.ModelRef;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import java.time.LocalDate;
import static com.google.common.collect.Lists.newArrayList;
/**
* @author xiaoyu
*/
@Configuration
@EnableSwagger2
public class SwaggerConfig {
private static final String SWAGGER_SCAN_BASE_PACKAGE = "com.happylifeplat.transaction.admin.controller";
private static final String VERSION = "1.0.0";
ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("Swagger API")
.description("transaction-admin 平台接口测试")
.license("Apache 2.0")
.licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html")
.termsOfServiceUrl("")
.version(VERSION)
.contact(new Contact("xiaoyu", "", "549477611@qq.com"))
.build();
}
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select().apis(RequestHandlerSelectors.withClassAnnotation(RestController.class))
// .paths(paths())
.build().pathMapping("/").directModelSubstitute(LocalDate.class, String.class)
.genericModelSubstitutes(ResponseEntity.class).useDefaultResponseMessages(false)
.globalResponseMessage(RequestMethod.GET, newArrayList(new ResponseMessageBuilder().code(500).message("500 message")
.responseModel(new ModelRef("Error")).build()));
}
}

View File

@ -1,31 +1,30 @@
/*
* 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
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
* 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 com.happylifeplat.tcc.admin.controller;
package com.hmily.tcc.admin.controller;
import com.happylifeplat.tcc.admin.annotation.Permission;
import com.happylifeplat.tcc.admin.dto.CompensationDTO;
import com.happylifeplat.tcc.admin.page.CommonPager;
import com.happylifeplat.tcc.admin.query.CompensationQuery;
import com.happylifeplat.tcc.admin.service.ApplicationNameService;
import com.happylifeplat.tcc.admin.service.CompensationService;
import com.happylifeplat.tcc.admin.vo.TccCompensationVO;
import com.happylifeplat.tcc.common.utils.httpclient.AjaxResponse;
import com.hmily.tcc.admin.annotation.Permission;
import com.hmily.tcc.admin.dto.CompensationDTO;
import com.hmily.tcc.admin.page.CommonPager;
import com.hmily.tcc.admin.query.CompensationQuery;
import com.hmily.tcc.admin.service.ApplicationNameService;
import com.hmily.tcc.admin.service.CompensationService;
import com.hmily.tcc.admin.vo.TccCompensationVO;
import com.hmily.tcc.common.utils.httpclient.AjaxResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;

View File

@ -0,0 +1,59 @@
/*
* 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 com.hmily.tcc.admin.controller;
import com.hmily.tcc.admin.dto.UserDTO;
import com.hmily.tcc.admin.service.LoginService;
import com.hmily.tcc.common.utils.httpclient.AjaxResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>Description: .</p>
*
* @author xiaoyu(Myth)
* @version 1.0
* @date 2017/10/20 10:11
* @since JDK 1.8
*/
@RestController
public class LoginController {
private final LoginService loginService;
@Autowired
public LoginController(LoginService loginService) {
this.loginService = loginService;
}
@PostMapping("/login")
public AjaxResponse login(@RequestBody UserDTO userDTO) {
final Boolean login = loginService.login(userDTO.getUserName(), userDTO.getPassword());
return AjaxResponse.success(login);
}
@PostMapping("/logout")
public AjaxResponse logout() {
return AjaxResponse.success(loginService.logout());
}
}

View File

@ -0,0 +1,45 @@
/*
* 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 com.hmily.tcc.admin.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* <p>Description: .</p>
*
* @author xiaoyu(Myth)
* @version 1.0
* @date 2017/10/24 16:24
* @since JDK 1.8
*/
@Data
public class CompensationDTO implements Serializable {
private static final long serialVersionUID = 6905402148490426011L;
private String applicationName;
private List<String> ids;
private String id;
private Integer retry;
}

View File

@ -0,0 +1,40 @@
/*
* 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 com.hmily.tcc.admin.dto;
import lombok.Data;
import java.io.Serializable;
/**
* <p>Description: .</p>
*
* @author xiaoyu(Myth)
* @version 1.0
* @date 2017/10/23 18:18
* @since JDK 1.8
*/
@Data
public class UserDTO implements Serializable {
private static final long serialVersionUID = -3479973014221253748L;
private String userName;
private String password;
}

View File

@ -1,23 +1,22 @@
/*
* 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
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
* 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 com.happylifeplat.tcc.admin.filter;
package com.hmily.tcc.admin.filter;
import org.springframework.stereotype.Component;

View File

@ -0,0 +1,50 @@
/*
* 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 com.hmily.tcc.admin.helper;
import com.hmily.tcc.admin.vo.TccCompensationVO;
import com.hmily.tcc.common.bean.adapter.CoordinatorRepositoryAdapter;
import com.hmily.tcc.common.utils.DateUtils;
/**
* <p>Description: .</p>
*
* @author xiaoyu(Myth)
* @version 1.0
* @date 2017/10/23 11:53
* @since JDK 1.8
*/
public class ConvertHelper {
public static TccCompensationVO buildVO(CoordinatorRepositoryAdapter adapter) {
TccCompensationVO vo = new TccCompensationVO();
vo.setTransId(adapter.getTransId());
vo.setCreateTime(DateUtils.parseDate(adapter.getCreateTime()));
vo.setRetriedCount(adapter.getRetriedCount());
vo.setLastTime(DateUtils.parseDate(adapter.getLastTime()));
vo.setVersion(adapter.getVersion());
vo.setTargetClass(adapter.getTargetClass());
vo.setTargetMethod(adapter.getTargetMethod());
vo.setConfirmMethod(adapter.getConfirmMethod());
vo.setCancelMethod(adapter.getCancelMethod());
return vo;
}
}

View File

@ -1,24 +1,23 @@
/*
* 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
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
* 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 com.happylifeplat.tcc.admin.helper;
package com.hmily.tcc.admin.helper;
import com.happylifeplat.tcc.admin.page.PageParameter;
import com.hmily.tcc.admin.page.PageParameter;
/**
* <p>Description: .</p>

View File

@ -1,25 +1,24 @@
/*
* 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
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
* 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 com.happylifeplat.tcc.admin.interceptor;
package com.hmily.tcc.admin.interceptor;
import com.happylifeplat.tcc.admin.service.login.LoginServiceImpl;
import com.happylifeplat.tcc.admin.annotation.Permission;
import com.hmily.tcc.admin.service.login.LoginServiceImpl;
import com.hmily.tcc.admin.annotation.Permission;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

View File

@ -0,0 +1,44 @@
/*
* 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 com.hmily.tcc.admin.page;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author xiaoyu
*/
@Data
public class CommonPager<T> implements Serializable {
private static final long serialVersionUID = -1220101004792874251L;
/**
* 分页信息
*/
private PageParameter page;
/**
* 返回数据
*/
private List<T> dataList;
}

View File

@ -1,22 +1,21 @@
/*
* 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
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
* 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 com.happylifeplat.tcc.admin.page;
package com.hmily.tcc.admin.page;
import lombok.Data;

View File

@ -0,0 +1,60 @@
/*
* 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 com.hmily.tcc.admin.query;
import com.hmily.tcc.admin.page.PageParameter;
import lombok.Data;
import java.io.Serializable;
/**
* <p>Description: .</p>
*
* @author xiaoyu(Myth)
* @version 1.0
* @date 2017/10/19 16:46
* @since JDK 1.8
*/
@Data
public class CompensationQuery implements Serializable {
private static final long serialVersionUID = 3297929795348894462L;
/**
* 应用名称
*/
private String applicationName;
/**
* 事务id
*/
private String transId;
/**
* 重试次数
*/
private Integer retry;
/**
* 分页信息
*/
private PageParameter pageParameter;
}

View File

@ -0,0 +1,39 @@
/*
* 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 com.hmily.tcc.admin.service;
import java.util.List;
/**
* <p>Description: .</p>
*
* @author xiaoyu(Myth)
* @version 1.0
* @date 2017/10/20 16:34
* @since JDK 1.8
*/
public interface ApplicationNameService {
/**
* 获取之前参与分布式事务项目的应用名称
*
* @return List<String>
*/
List<String> list();
}

View File

@ -0,0 +1,65 @@
/*
* 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 com.hmily.tcc.admin.service;
import com.hmily.tcc.admin.page.CommonPager;
import com.hmily.tcc.admin.query.CompensationQuery;
import com.hmily.tcc.admin.vo.TccCompensationVO;
import java.util.List;
/**
* <p>Description: .</p>
*
* @author xiaoyu(Myth)
* @version 1.0
* @date 2017/10/19 16:36
* @since JDK 1.8
*/
public interface CompensationService {
/**
* 分页获取补偿事务信息
*
* @param query 查询条件
* @return CommonPager<TransactionRecoverVO>
*/
CommonPager<TccCompensationVO> listByPage(CompensationQuery query);
/**
* 批量删除补偿事务信息
*
* @param ids ids 事务id集合
* @param applicationName 应用名称
* @return true 成功
*/
Boolean batchRemove(List<String> ids, String applicationName);
/**
* 更改恢复次数
*
* @param id 事务id
* @param retry 恢复次数
* @param applicationName 应用名称
* @return true 成功
*/
Boolean updateRetry(String id, Integer retry, String applicationName);
}

View File

@ -0,0 +1,43 @@
/*
* 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 com.hmily.tcc.admin.service;
/**
* <p>Description: .</p>
*
* @author xiaoyu(Myth)
* @version 1.0
* @date 2017/10/20 10:17
* @since JDK 1.8
*/
public interface LoginService {
/**
* 登录接口验证用户名 密码
* @param userName 用户名
* @param password 密码
* @return true 成功
*/
Boolean login(String userName,String password);
/**
* 用户登出
* @return true 成功
*/
Boolean logout();
}

View File

@ -1,36 +1,35 @@
/*
* 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
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
* 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 com.happylifeplat.tcc.admin.service.compensate;
package com.hmily.tcc.admin.service.compensate;
import com.happylifeplat.tcc.admin.helper.PageHelper;
import com.happylifeplat.tcc.admin.service.CompensationService;
import com.happylifeplat.tcc.admin.helper.ConvertHelper;
import com.happylifeplat.tcc.admin.page.CommonPager;
import com.happylifeplat.tcc.admin.page.PageParameter;
import com.happylifeplat.tcc.admin.query.CompensationQuery;
import com.happylifeplat.tcc.admin.vo.TccCompensationVO;
import com.happylifeplat.tcc.common.bean.adapter.CoordinatorRepositoryAdapter;
import com.happylifeplat.tcc.common.exception.TccException;
import com.happylifeplat.tcc.common.serializer.ObjectSerializer;
import com.happylifeplat.tcc.common.utils.DateUtils;
import com.happylifeplat.tcc.common.utils.FileUtils;
import com.happylifeplat.tcc.common.utils.RepositoryPathUtils;
import com.hmily.tcc.admin.helper.PageHelper;
import com.hmily.tcc.admin.service.CompensationService;
import com.hmily.tcc.admin.helper.ConvertHelper;
import com.hmily.tcc.admin.page.CommonPager;
import com.hmily.tcc.admin.page.PageParameter;
import com.hmily.tcc.admin.query.CompensationQuery;
import com.hmily.tcc.admin.vo.TccCompensationVO;
import com.hmily.tcc.common.bean.adapter.CoordinatorRepositoryAdapter;
import com.hmily.tcc.common.exception.TccException;
import com.hmily.tcc.common.serializer.ObjectSerializer;
import com.hmily.tcc.common.utils.DateUtils;
import com.hmily.tcc.common.utils.FileUtils;
import com.hmily.tcc.common.utils.RepositoryPathUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -1,33 +1,32 @@
/*
* 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
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
* 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 com.happylifeplat.tcc.admin.service.compensate;
package com.hmily.tcc.admin.service.compensate;
import com.happylifeplat.tcc.admin.helper.PageHelper;
import com.happylifeplat.tcc.admin.page.CommonPager;
import com.happylifeplat.tcc.admin.page.PageParameter;
import com.happylifeplat.tcc.admin.service.CompensationService;
import com.happylifeplat.tcc.admin.query.CompensationQuery;
import com.happylifeplat.tcc.admin.vo.TccCompensationVO;
import com.happylifeplat.tcc.common.utils.DateUtils;
import com.happylifeplat.tcc.common.utils.DbTypeUtils;
import com.happylifeplat.tcc.common.utils.LogUtil;
import com.happylifeplat.tcc.common.utils.RepositoryPathUtils;
import com.hmily.tcc.admin.helper.PageHelper;
import com.hmily.tcc.admin.page.CommonPager;
import com.hmily.tcc.admin.page.PageParameter;
import com.hmily.tcc.admin.service.CompensationService;
import com.hmily.tcc.admin.query.CompensationQuery;
import com.hmily.tcc.admin.vo.TccCompensationVO;
import com.hmily.tcc.common.utils.DateUtils;
import com.hmily.tcc.common.utils.DbTypeUtils;
import com.hmily.tcc.common.utils.LogUtil;
import com.hmily.tcc.common.utils.RepositoryPathUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;

View File

@ -1,34 +1,33 @@
/*
* 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
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
* 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 com.happylifeplat.tcc.admin.service.compensate;
package com.hmily.tcc.admin.service.compensate;
import com.happylifeplat.tcc.admin.helper.PageHelper;
import com.happylifeplat.tcc.admin.page.CommonPager;
import com.happylifeplat.tcc.admin.page.PageParameter;
import com.happylifeplat.tcc.admin.service.CompensationService;
import com.happylifeplat.tcc.admin.helper.ConvertHelper;
import com.happylifeplat.tcc.admin.query.CompensationQuery;
import com.happylifeplat.tcc.admin.vo.TccCompensationVO;
import com.happylifeplat.tcc.common.bean.adapter.MongoAdapter;
import com.happylifeplat.tcc.common.exception.TccRuntimeException;
import com.happylifeplat.tcc.common.utils.DateUtils;
import com.happylifeplat.tcc.common.utils.RepositoryPathUtils;
import com.hmily.tcc.admin.helper.PageHelper;
import com.hmily.tcc.admin.page.CommonPager;
import com.hmily.tcc.admin.page.PageParameter;
import com.hmily.tcc.admin.service.CompensationService;
import com.hmily.tcc.admin.helper.ConvertHelper;
import com.hmily.tcc.admin.query.CompensationQuery;
import com.hmily.tcc.admin.vo.TccCompensationVO;
import com.hmily.tcc.common.bean.adapter.MongoAdapter;
import com.hmily.tcc.common.exception.TccRuntimeException;
import com.hmily.tcc.common.utils.DateUtils;
import com.hmily.tcc.common.utils.RepositoryPathUtils;
import com.mongodb.WriteResult;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;

View File

@ -1,36 +1,35 @@
/*
* 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
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
* 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 com.happylifeplat.tcc.admin.service.compensate;
package com.hmily.tcc.admin.service.compensate;
import com.google.common.collect.Sets;
import com.happylifeplat.tcc.admin.helper.ConvertHelper;
import com.happylifeplat.tcc.admin.helper.PageHelper;
import com.happylifeplat.tcc.admin.page.CommonPager;
import com.happylifeplat.tcc.admin.query.CompensationQuery;
import com.happylifeplat.tcc.admin.service.CompensationService;
import com.happylifeplat.tcc.admin.vo.TccCompensationVO;
import com.happylifeplat.tcc.common.bean.adapter.CoordinatorRepositoryAdapter;
import com.happylifeplat.tcc.common.exception.TccException;
import com.happylifeplat.tcc.common.jedis.JedisClient;
import com.happylifeplat.tcc.common.serializer.ObjectSerializer;
import com.happylifeplat.tcc.common.utils.DateUtils;
import com.happylifeplat.tcc.common.utils.RepositoryPathUtils;
import com.hmily.tcc.admin.helper.ConvertHelper;
import com.hmily.tcc.admin.helper.PageHelper;
import com.hmily.tcc.admin.page.CommonPager;
import com.hmily.tcc.admin.query.CompensationQuery;
import com.hmily.tcc.admin.service.CompensationService;
import com.hmily.tcc.admin.vo.TccCompensationVO;
import com.hmily.tcc.common.bean.adapter.CoordinatorRepositoryAdapter;
import com.hmily.tcc.common.exception.TccException;
import com.hmily.tcc.common.jedis.JedisClient;
import com.hmily.tcc.common.serializer.ObjectSerializer;
import com.hmily.tcc.common.utils.DateUtils;
import com.hmily.tcc.common.utils.RepositoryPathUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;

View File

@ -1,35 +1,34 @@
/*
* 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
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
* 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 com.happylifeplat.tcc.admin.service.compensate;
package com.hmily.tcc.admin.service.compensate;
import com.google.common.collect.Lists;
import com.happylifeplat.tcc.admin.helper.ConvertHelper;
import com.happylifeplat.tcc.admin.helper.PageHelper;
import com.happylifeplat.tcc.admin.page.CommonPager;
import com.happylifeplat.tcc.admin.query.CompensationQuery;
import com.happylifeplat.tcc.admin.service.CompensationService;
import com.happylifeplat.tcc.admin.vo.TccCompensationVO;
import com.happylifeplat.tcc.common.bean.adapter.CoordinatorRepositoryAdapter;
import com.happylifeplat.tcc.common.exception.TccException;
import com.happylifeplat.tcc.common.serializer.ObjectSerializer;
import com.happylifeplat.tcc.common.utils.DateUtils;
import com.happylifeplat.tcc.common.utils.RepositoryPathUtils;
import com.hmily.tcc.admin.helper.ConvertHelper;
import com.hmily.tcc.admin.helper.PageHelper;
import com.hmily.tcc.admin.page.CommonPager;
import com.hmily.tcc.admin.query.CompensationQuery;
import com.hmily.tcc.admin.service.CompensationService;
import com.hmily.tcc.admin.vo.TccCompensationVO;
import com.hmily.tcc.common.bean.adapter.CoordinatorRepositoryAdapter;
import com.hmily.tcc.common.exception.TccException;
import com.hmily.tcc.common.serializer.ObjectSerializer;
import com.hmily.tcc.common.utils.DateUtils;
import com.hmily.tcc.common.utils.RepositoryPathUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.zookeeper.CreateMode;

View File

@ -1,25 +1,24 @@
/*
* 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
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
* 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 com.happylifeplat.tcc.admin.service.login;
package com.hmily.tcc.admin.service.login;
import com.happylifeplat.tcc.admin.service.LoginService;
import com.happylifeplat.tcc.common.utils.LogUtil;
import com.hmily.tcc.admin.service.LoginService;
import com.hmily.tcc.common.utils.LogUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;

View File

@ -1,34 +1,33 @@
/*
* 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
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
* 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 com.happylifeplat.tcc.admin.spi;
package com.hmily.tcc.admin.spi;
import com.alibaba.druid.pool.DruidDataSource;
import com.google.common.base.Splitter;
import com.happylifeplat.tcc.admin.service.CompensationService;
import com.happylifeplat.tcc.admin.service.compensate.FileCompensationServiceImpl;
import com.happylifeplat.tcc.admin.service.compensate.JdbcCompensationServiceImpl;
import com.happylifeplat.tcc.admin.service.compensate.MongoCompensationServiceImpl;
import com.happylifeplat.tcc.admin.service.compensate.RedisCompensationServiceImpl;
import com.happylifeplat.tcc.admin.service.compensate.ZookeeperCompensationServiceImpl;
import com.happylifeplat.tcc.common.jedis.JedisClient;
import com.happylifeplat.tcc.common.jedis.JedisClientCluster;
import com.happylifeplat.tcc.common.jedis.JedisClientSingle;
import com.hmily.tcc.admin.service.CompensationService;
import com.hmily.tcc.admin.service.compensate.FileCompensationServiceImpl;
import com.hmily.tcc.admin.service.compensate.JdbcCompensationServiceImpl;
import com.hmily.tcc.admin.service.compensate.MongoCompensationServiceImpl;
import com.hmily.tcc.admin.service.compensate.RedisCompensationServiceImpl;
import com.hmily.tcc.admin.service.compensate.ZookeeperCompensationServiceImpl;
import com.hmily.tcc.common.jedis.JedisClient;
import com.hmily.tcc.common.jedis.JedisClientCluster;
import com.hmily.tcc.common.jedis.JedisClientSingle;
import com.mongodb.MongoCredential;
import com.mongodb.ServerAddress;
import org.apache.commons.lang3.StringUtils;

View File

@ -1,22 +1,21 @@
/*
* 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
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
* 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 com.happylifeplat.tcc.admin.vo;
package com.hmily.tcc.admin.vo;
import lombok.Data;

View File

@ -0,0 +1,4 @@
com.hmily.tcc.common.serializer.KryoSerializer
com.hmily.tcc.common.serializer.ProtostuffSerializer
com.hmily.tcc.common.serializer.HessianSerializer
com.hmily.tcc.common.serializer.JavaSerializer

View File

@ -1,20 +1,4 @@
#
#
# Copyright 2017-2018 549477611@qq.com(xiaoyu)
#
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the GNU
# Lesser General Public License, as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
# for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this distribution; if not, see <http://www.gnu.org/licenses/>.
#
#
#\u670D\u52A1\u7AEF\u53E3
server.port=8888

View File

@ -1,28 +1,27 @@
/*
* 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
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
* 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 com.happylifeplat.tcc.admin.service.compensate;
package com.hmily.tcc.admin.service.compensate;
import com.happylifeplat.tcc.admin.page.CommonPager;
import com.happylifeplat.tcc.admin.page.PageParameter;
import com.happylifeplat.tcc.admin.service.CompensationService;
import com.happylifeplat.tcc.admin.query.CompensationQuery;
import com.happylifeplat.tcc.admin.vo.TccCompensationVO;
import com.hmily.tcc.admin.page.CommonPager;
import com.hmily.tcc.admin.page.PageParameter;
import com.hmily.tcc.admin.service.CompensationService;
import com.hmily.tcc.admin.query.CompensationQuery;
import com.hmily.tcc.admin.vo.TccCompensationVO;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;

View File

@ -0,0 +1,65 @@
/*
* 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 com.hmily.tcc.admin.service.compensate;
import com.hmily.tcc.admin.page.CommonPager;
import com.hmily.tcc.admin.page.PageParameter;
import com.hmily.tcc.admin.service.CompensationService;
import com.hmily.tcc.admin.query.CompensationQuery;
import com.hmily.tcc.admin.vo.TccCompensationVO;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
/**
* <p>Description:</p>
*
* @author xiaoyu(Myth)
* @version 1.0
* @date 2017/10/20 16:01
* @since JDK 1.8
*/
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class MongoCompensationServiceImplTest {
@Autowired
private CompensationService compensationService;
@Test
public void listByPage() throws Exception {
CompensationQuery query = new CompensationQuery();
query.setApplicationName("alipay-service");
PageParameter pageParameter = new PageParameter(1,5);
query.setPageParameter(pageParameter);
final CommonPager<TccCompensationVO> voCommonPager = compensationService.listByPage(query);
}
}

View File

@ -0,0 +1,66 @@
/*
* 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 com.hmily.tcc.admin.service.compensate;
import com.hmily.tcc.admin.page.CommonPager;
import com.hmily.tcc.admin.page.PageParameter;
import com.hmily.tcc.admin.query.CompensationQuery;
import com.hmily.tcc.admin.service.CompensationService;
import com.hmily.tcc.admin.vo.TccCompensationVO;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
/**
* <p>Description:</p>
*
* @author xiaoyu(Myth)
* @version 1.0
* @date 2017/10/20 16:01
* @since JDK 1.8
*/
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class RedisCompensationServiceImplTest {
@Autowired
private CompensationService compensationService;
@Test
public void listByPage() throws Exception {
CompensationQuery query = new CompensationQuery();
query.setApplicationName("alipay-service");
PageParameter pageParameter = new PageParameter(1,1);
query.setPageParameter(pageParameter);
query.setRetry(2);
query.setTransId("2075304338");
final CommonPager<TccCompensationVO> voCommonPager = compensationService.listByPage(query);
}
}

View File

@ -0,0 +1,65 @@
/*
* 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 com.hmily.tcc.admin.service.compensate;
import com.hmily.tcc.admin.page.CommonPager;
import com.hmily.tcc.admin.page.PageParameter;
import com.hmily.tcc.admin.service.CompensationService;
import com.hmily.tcc.admin.query.CompensationQuery;
import com.hmily.tcc.admin.vo.TccCompensationVO;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
/**
* <p>Description:</p>
*
* @author xiaoyu(Myth)
* @version 1.0
* @date 2017/10/20 16:01
* @since JDK 1.8
*/
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class ZookeeperCompensationServiceImplTest {
@Autowired
private CompensationService compensationService;
@Test
public void listByPage() throws Exception {
CompensationQuery query = new CompensationQuery();
query.setApplicationName("alipay-service");
PageParameter pageParameter = new PageParameter(1,8);
query.setPageParameter(pageParameter);
final CommonPager<TccCompensationVO> voCommonPager = compensationService.listByPage(query);
}
}

View File

@ -0,0 +1,29 @@
<?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">
<parent>
<artifactId>hmily-tcc</artifactId>
<groupId>com.hmily.tcc</groupId>
<version>1.1.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>hmily-tcc-annotation</artifactId>
<build>
<finalName>hmily-tcc-annotation</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,21 +1,20 @@
/*
* 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
*
* Copyright 2017-2018 549477611@qq.com(xiaoyu)
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, see <http://www.gnu.org/licenses/>.
* 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 com.happylifeplat.tcc.annotation;
package com.hmily.tcc.annotation;
/**

Some files were not shown because too many files have changed in this diff Show More