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

Commit

Permalink
Remove ETCD register center example in orchestration example (#188)
Browse files Browse the repository at this point in the history
* Remove ETCD register center example in orchestration raw example

* Remove ETCD register center example in orchestration spring-boot example

* Remove ETCD register center example in orchestration spring-namespace example

* fix error test case for orchestration raw example

* change encrypt + orchestration example test case, reason: #3352
  • Loading branch information
KomachiSion authored and terrymanu committed Oct 28, 2019
1 parent c0ab3b7 commit 679abb1
Show file tree
Hide file tree
Showing 16 changed files with 27 additions and 374 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@

public enum RegistryCenterType {

ZOOKEEPER, ETCD
ZOOKEEPER, NACOS
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public Long insert(final OrderItem orderItem) throws SQLException {

@Override
public void delete(final Long orderItemId) throws SQLException {
String sql = "DELETE FROM t_order_item WHERE order_item_id=?";
String sql = "DELETE FROM t_order_item WHERE order_id=?";
try (Connection connection = dataSource.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement(sql)) {
preparedStatement.setLong(1, orderItemId);
Expand All @@ -95,7 +95,9 @@ public void delete(final Long orderItemId) throws SQLException {

@Override
public List<OrderItem> selectAll() throws SQLException {
String sql = "SELECT i.* FROM t_order o, t_order_item i WHERE o.order_id = i.order_id";
// TODO Associated query with encrypt may query and decrypt failed. see https://github.com/apache/incubator-shardingsphere/issues/3352
// String sql = "SELECT i.* FROM t_order o, t_order_item i WHERE o.order_id = i.order_id";
String sql = "SELECT * FROM t_order_item";
return getOrderItems(sql);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,10 @@
<groupId>org.apache.shardingsphere</groupId>
<artifactId>sharding-jdbc-orchestration</artifactId>
</dependency>
<!--<dependency>-->
<!--<groupId>org.apache.shardingsphere</groupId>-->
<!--<artifactId>sharding-orchestration-reg-zookeeper-curator</artifactId>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>io.shardingsphere</groupId>-->
<!--<artifactId>sharding-orchestration-reg-etcd</artifactId>-->
<!--</dependency>-->
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>sharding-orchestration-reg-zookeeper-curator</artifactId>
</dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>sharding-orchestration-reg-nacos</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
/*
* 1. Please make sure master-slave data sync on MySQL is running correctly. Otherwise this example will query empty data from slave.
* 2. Please make sure sharding-orchestration-reg-zookeeper-curator in your pom if registryCenterType = RegistryCenterType.ZOOKEEPER.
* 3. Please make sure sharding-orchestration-reg-etcd in your pom if registryCenterType = RegistryCenterType.ETCD.
* 3. 3. Please make sure sharding-orchestration-reg-nacos in your pom if registryCenterType = RegistryCenterType.NACOS.
*/
public class JavaConfigurationExampleMain {

Expand All @@ -50,9 +50,8 @@ public class JavaConfigurationExampleMain {
private static boolean loadConfigFromRegCenter = false;
// private static boolean loadConfigFromRegCenter = true;

// private static RegistryCenterType registryCenterType = RegistryCenterType.ZOOKEEPER;
// private static RegistryCenterType registryCenterType = RegistryCenterType.ETCD;
private static RegistryCenterType registryCenterType = RegistryCenterType.NACOS;
private static RegistryCenterType registryCenterType = RegistryCenterType.ZOOKEEPER;
// private static RegistryCenterType registryCenterType = RegistryCenterType.NACOS;

public static void main(final String[] args) throws Exception {
DataSource dataSource = getDataSource(shardingType, loadConfigFromRegCenter);
Expand Down Expand Up @@ -84,8 +83,7 @@ private static DataSource getDataSource(final ShardingType shardingType, final b
}

private static RegistryCenterConfiguration getRegistryCenterConfiguration(final RegistryCenterType registryCenterType) {
return RegistryCenterType.ZOOKEEPER == registryCenterType ? RegistryCenterConfigurationUtil.getZooKeeperConfiguration()
: RegistryCenterType.NACOS == registryCenterType ? RegistryCenterConfigurationUtil.getNacosConfiguration() : RegistryCenterConfigurationUtil.getEtcdConfiguration();
return RegistryCenterType.ZOOKEEPER == registryCenterType ? RegistryCenterConfigurationUtil.getZooKeeperConfiguration() : RegistryCenterConfigurationUtil.getNacosConfiguration();
}

private static ExampleService getExampleService(final DataSource dataSource) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
/*
* 1. Please make sure master-slave data sync on MySQL is running correctly. Otherwise this example will query empty data from slave.
* 2. Please make sure sharding-orchestration-reg-zookeeper-curator in your pom if registryCenterType = RegistryCenterType.ZOOKEEPER.
* 3. Please make sure sharding-orchestration-reg-etcd in your pom if registryCenterType = RegistryCenterType.ETCD.
* 3. Please make sure sharding-orchestration-reg-nacos in your pom if registryCenterType = RegistryCenterType.NACOS.
*/
public class YamlConfigurationExampleMain {

Expand All @@ -46,9 +46,8 @@ public class YamlConfigurationExampleMain {
private static boolean loadConfigFromRegCenter = false;
// private static boolean loadConfigFromRegCenter = true;

// private static RegistryCenterType registryCenterType = RegistryCenterType.ZOOKEEPER;
// private static RegistryCenterType registryCenterType = RegistryCenterType.ETCD;
private static RegistryCenterType registryCenterType = RegistryCenterType.NACOS;
private static RegistryCenterType registryCenterType = RegistryCenterType.ZOOKEEPER;
// private static RegistryCenterType registryCenterType = RegistryCenterType.NACOS;

public static void main(final String[] args) throws Exception {
DataSource dataSource = getDataSource(registryCenterType, loadConfigFromRegCenter, shardingType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ public class RegistryCenterConfigurationUtil {

private static final String NAMESPACE = "orchestration-java-demo";

private static final String ETCD_CONNECTION_STRING = "http://localhost:2379";

private static final String NACOS_CONNECTION_STRING = "localhost:8848";

private static final String NACOS_NAMESPACE = "";
Expand All @@ -40,12 +38,6 @@ public static RegistryCenterConfiguration getZooKeeperConfiguration() {
return result;
}

public static RegistryCenterConfiguration getEtcdConfiguration() {
RegistryCenterConfiguration result = new RegistryCenterConfiguration("etcd");
result.setServerLists(ETCD_CONNECTION_STRING);
return result;
}

public static RegistryCenterConfiguration getNacosConfiguration() {
Properties properties = new Properties();
properties.setProperty("group", "SHARDING_SPHERE_DEFAULT_GROUP");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,10 @@
<groupId>org.apache.shardingsphere</groupId>
<artifactId>sharding-jdbc-orchestration-spring-boot-starter</artifactId>
</dependency>
<!--<dependency>-->
<!--<groupId>org.apache.shardingsphere</groupId>-->
<!--<artifactId>sharding-orchestration-reg-zookeeper-curator</artifactId>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>io.shardingsphere</groupId>-->
<!--<artifactId>sharding-orchestration-reg-etcd</artifactId>-->
<!--</dependency>-->
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>sharding-orchestration-reg-zookeeper-curator</artifactId>
</dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>sharding-orchestration-reg-nacos</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,14 @@ spring.jpa.properties.hibernate.hbm2ddl.auto=create-drop
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
spring.jpa.properties.hibernate.show_sql=false

#spring.profiles.active=local-zookeeper-sharding-databases-tables
spring.profiles.active=local-zookeeper-sharding-databases-tables
#spring.profiles.active=local-zookeeper-master-slave

#spring.profiles.active=local-etcd-sharding-databases-tables
#spring.profiles.active=local-etcd-master-slave

#spring.profiles.active=cloud-zookeeper-sharding-databases-tables
#spring.profiles.active=cloud-zookeeper-master-slave

#spring.profiles.active=cloud-etcd-sharding-databases-tables
#spring.profiles.active=cloud-etcd-master-slave

#spring.profiles.active=local-zookeeper-encrypt
#spring.profiles.active=cloud-zookeeper-encrypt

spring.profiles.active=local-nacos-sharding-databases-tables
#spring.profiles.active=local-nacos-sharding-databases-tables
#spring.profiles.active=cloud-nacos-sharding-databases-tables
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,10 @@
<groupId>org.apache.shardingsphere</groupId>
<artifactId>sharding-jdbc-orchestration-spring-namespace</artifactId>
</dependency>
<!--<dependency>-->
<!--<groupId>org.apache.shardingsphere</groupId>-->
<!--<artifactId>sharding-orchestration-reg-zookeeper-curator</artifactId>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>io.shardingsphere</groupId>-->
<!--<artifactId>sharding-orchestration-reg-etcd</artifactId>-->
<!--</dependency>-->
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>sharding-orchestration-reg-zookeeper-curator</artifactId>
</dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>sharding-orchestration-reg-nacos</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public class ExampleMain {
// private static boolean loadConfigFromRegCenter = true;

// private static RegistryCenterType registryCenterType = RegistryCenterType.ZOOKEEPER;
// private static RegistryCenterType registryCenterType = RegistryCenterType.ETCD;
private static RegistryCenterType registryCenterType = RegistryCenterType.NACOS;

public static void main(final String[] args) throws SQLException {
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 679abb1

Please sign in to comment.