Skip to content
This repository has been archived by the owner on Aug 15, 2020. It is now read-only.

Commit

Permalink
for checkstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu committed Aug 16, 2019
1 parent 627f8b4 commit e300273
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 21 deletions.
2 changes: 1 addition & 1 deletion docker/sharding-proxy/sharding/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ services:
container_name: sharding-sphere-proxy
depends_on:
- mysql
## wait-for-it.sh will make proxy entrypoint wait until mysql container 3306 port open
## wait-for-it.sh will make proxy entry point wait until mysql container 3306 port open
entrypoint: >
/bin/sh -c "/opt/wait-for-it.sh sharding-sphere-mysql:3306 --timeout=20 --strict --
&& /opt/sharding-proxy/bin/start.sh 3308
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ public enum ShardingType {

SHARDING_MASTER_SLAVE,

ENCRYPT;
ENCRYPT
}
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ private List<User> getUsers(final String sql) {
result.add(user);
}
} catch (final SQLException ignored) {
System.out.println(ignored);
}
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,30 +30,30 @@
import java.util.Set;

public class SportsmanServiceImpl implements CommonService {

private final CountryRepository countryRepository;

private final SportsmanRepository sportsmanRepository;

public SportsmanServiceImpl(final CountryRepository countryRepository, final SportsmanRepository sportsmanRepository) {
this.countryRepository = countryRepository;
this.sportsmanRepository = sportsmanRepository;
}

@Override
public void initEnvironment() {
countryRepository.createTableIfNotExists();
sportsmanRepository.createTableIfNotExists();
countryRepository.truncateTable();
sportsmanRepository.truncateTable();
}

@Override
public void cleanEnvironment() {
countryRepository.dropTable();
sportsmanRepository.dropTable();
}

@Override
public void processSuccess() {
System.out.println("-------------- Process Success Begin ---------------");
Expand All @@ -63,7 +63,7 @@ public void processSuccess() {
printData();
System.out.println("-------------- Process Success Finish --------------");
}

private void deleteData(final InsertResult insertResult) {
System.out.println("---------------------------- Delete Data ----------------------------");
for (String each : insertResult.getCountryCodes()) {
Expand All @@ -73,22 +73,22 @@ private void deleteData(final InsertResult insertResult) {
sportsmanRepository.delete(each);
}
}

@Override
public void processFailure() {
System.out.println("-------------- Process Failure Begin ---------------");
insertData();
System.out.println("-------------- Process Failure Finish --------------");
throw new RuntimeException("Exception occur for transaction test.");
}

private InsertResult insertData() {
System.out.println("---------------------------- Insert Data ----------------------------");
List<String> countryCodes = insertCountry();
List<Long> sportsmanIds = insertSportman(countryCodes);
return new InsertResult(countryCodes, sportsmanIds);
}

private List<Long> insertSportman(final List<String> countryCodes) {
List<Long> result = new ArrayList<>(countryCodes.size());
int index = 0;
Expand All @@ -101,7 +101,7 @@ private List<Long> insertSportman(final List<String> countryCodes) {
}
return result;
}

private List<String> insertCountry() {
Set<String> result = new LinkedHashSet<>();
for (Locale each : Locale.getAvailableLocales()) {
Expand All @@ -120,7 +120,7 @@ private List<String> insertCountry() {
}
return new ArrayList<>(result);
}

@Override
public void printData() {
System.out.println("---------------------------- Print Country Data -------------------");
Expand All @@ -132,22 +132,22 @@ public void printData() {
System.out.println(each);
}
}

private class InsertResult {

private final List<String> countryCodes;

private final List<Long> sportsmanIds;

InsertResult(final List<String> countryCodes, final List<Long> sportsmanIds) {
this.countryCodes = countryCodes;
this.sportsmanIds = sportsmanIds;
}

public List<Long> getSportsmanIds() {
return sportsmanIds;
}

public List<String> getCountryCodes() {
return countryCodes;
}
Expand Down

0 comments on commit e300273

Please sign in to comment.