-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
540 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# coc-war |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
FROM openjdk:8-jre-alpine | ||
COPY coc-war*.jar app.jar | ||
EXPOSE 18900 | ||
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>coc-clan-war</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
<parent> | ||
<groupId>me.shufork.jaracks</groupId> | ||
<artifactId>sc-coc</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
</parent> | ||
|
||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>me.shufork.jaracks</groupId> | ||
<artifactId>common</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>me.shufork.jaracks</groupId> | ||
<artifactId>coc-common</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.cloud</groupId> | ||
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.cloud</groupId> | ||
<artifactId>spring-cloud-starter-config</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.cloud</groupId> | ||
<artifactId>spring-cloud-starter-bus-amqp</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.cloud</groupId> | ||
<artifactId>spring-cloud-starter-feign</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-validation</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.httpcomponents</groupId> | ||
<artifactId>httpclient</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.github.openfeign</groupId> | ||
<artifactId>feign-httpclient</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-actuator</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.retry</groupId> | ||
<artifactId>spring-retry</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.cloud</groupId> | ||
<artifactId>spring-cloud-starter-hystrix</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.cloud</groupId> | ||
<artifactId>spring-cloud-starter-stream-rabbit</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.cloud</groupId> | ||
<artifactId>spring-cloud-netflix-hystrix-stream</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.cloud</groupId> | ||
<artifactId>spring-cloud-sleuth-stream</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-data-redis</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>mysql</groupId> | ||
<artifactId>mysql-connector-java</artifactId> | ||
<scope>runtime</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.zaxxer</groupId> | ||
<artifactId>HikariCP</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-data-jpa</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.h2database</groupId> | ||
<artifactId>h2</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.liquibase</groupId> | ||
<artifactId>liquibase-core</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.modelmapper</groupId> | ||
<artifactId>modelmapper</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>joda-time</groupId> | ||
<artifactId>joda-time</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>net.logstash.logback</groupId> | ||
<artifactId>logstash-logback-encoder</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.springfox</groupId> | ||
<artifactId>springfox-swagger2</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.springfox</groupId> | ||
<artifactId>springfox-swagger-ui</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>de.codecentric</groupId> | ||
<artifactId>spring-boot-admin-starter-client</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<finalName>${project.artifactId}</finalName> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-source-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<groupId>com.spotify</groupId> | ||
<artifactId>docker-maven-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
26 changes: 26 additions & 0 deletions
26
coc-clan-war/src/main/java/me/shufork/biz/CocWarApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package me.shufork.biz; | ||
|
||
import me.shufork.common.mq.sink.WarLogLoadedSink; | ||
import me.shufork.common.mq.sink.WarLogRejectedSink; | ||
import me.shufork.common.mq.source.ClanFoundSource; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; | ||
import org.springframework.cloud.stream.annotation.EnableBinding; | ||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories; | ||
import springfox.documentation.swagger2.annotations.EnableSwagger2; | ||
|
||
|
||
@SpringBootApplication(scanBasePackages = {"me.shufork.biz", "me.shufork.common"}) | ||
@EnableDiscoveryClient | ||
@EnableBinding({ | ||
ClanFoundSource.class, | ||
WarLogLoadedSink.class, | ||
WarLogRejectedSink.class}) | ||
@EnableJpaRepositories(basePackages = "me.shufork.biz.repository") | ||
@EnableSwagger2 | ||
public class CocWarApplication { | ||
public static void main(String[] args) { | ||
SpringApplication.run(CocWarApplication.class, args); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
coc-clan-war/src/main/java/me/shufork/biz/config/CustomBeanConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package me.shufork.biz.config; | ||
|
||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
public class CustomBeanConfiguration { | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
coc-clan-war/src/main/java/me/shufork/biz/config/ModelMapperConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package me.shufork.biz.config; | ||
|
||
import me.shufork.biz.converter.WarLogEntryClanVoConverter; | ||
import me.shufork.biz.converter.WarLogEntryVoConverter; | ||
import me.shufork.biz.domain.CocWarLog; | ||
import me.shufork.biz.domain.CocWarTeam; | ||
import me.shufork.biz.vo.WarLogEntryClanVo; | ||
import me.shufork.biz.vo.WarLogEntryVo; | ||
import org.modelmapper.ModelMapper; | ||
import org.modelmapper.convention.MatchingStrategies; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
public class ModelMapperConfiguration { | ||
@Bean | ||
public ModelMapper modelMapper() { | ||
ModelMapper modelMapper = new ModelMapper(); | ||
modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); | ||
|
||
// note ignore version,createdTime,modifiedTime for domain object | ||
|
||
modelMapper.createTypeMap(WarLogEntryClanVo.class,CocWarTeam.class) | ||
.setConverter(new WarLogEntryClanVoConverter.ToCocWarTeam()); | ||
|
||
modelMapper.createTypeMap(CocWarTeam.class,WarLogEntryClanVo.class) | ||
.setConverter(new WarLogEntryClanVoConverter.FromCocWarTeam()); | ||
|
||
modelMapper.createTypeMap(CocWarLog.class,WarLogEntryVo.class) | ||
.setConverter(new WarLogEntryVoConverter.FromCocWarLog()); | ||
|
||
return modelMapper; | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
58 changes: 58 additions & 0 deletions
58
coc-clan-war/src/main/java/me/shufork/biz/utils/EntityKeyUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package me.shufork.biz.utils; | ||
|
||
import me.shufork.biz.domain.CocWarTeam; | ||
import me.shufork.biz.vo.WarLogEntryClanVo; | ||
import org.apache.commons.lang3.StringUtils; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
public final class EntityKeyUtils { | ||
|
||
private static final String KEY_JOIN_CHAR = "-"; | ||
|
||
private EntityKeyUtils(){} | ||
|
||
private static String makeKey(List<String> strings){ | ||
return strings.stream() | ||
.map(o-> StringUtils.trimToNull(o.toLowerCase())) | ||
.filter(o-> !StringUtils.isBlank(o)) | ||
.collect(Collectors.joining(KEY_JOIN_CHAR)); | ||
} | ||
|
||
public static String keyOfWarLog(String clanTag,String endTime){ | ||
if(StringUtils.isBlank(clanTag) || StringUtils.isBlank(endTime)){ | ||
throw new IllegalStateException("Can not make key"); | ||
} | ||
return makeKey(Arrays.asList( | ||
clanTag, | ||
endTime | ||
) | ||
); | ||
} | ||
|
||
public static String keyOf(WarLogEntryClanVo val){ | ||
if(StringUtils.isBlank(val.getTag()) || val.getWarTime() == null ){ | ||
throw new IllegalStateException("Can not make key"); | ||
} | ||
return makeKey(Arrays.asList( | ||
val.getTag(), | ||
Long.toString(val.getWarTime().getTime()) | ||
) | ||
); | ||
} | ||
|
||
public static String keyOf(CocWarTeam val){ | ||
|
||
if(StringUtils.isBlank(val.getClan()) || val.getWarTime() == null ){ | ||
throw new IllegalStateException("Can not make key"); | ||
} | ||
return makeKey(Arrays.asList( | ||
val.getClan(), | ||
Long.toString(val.getWarTime().getTime()) | ||
) | ||
); | ||
} | ||
|
||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.