소스 검색

清理无用工程:examcloud-config-center-starter

deason 4 년 전
부모
커밋
6eee79e28a
14개의 변경된 파일0개의 추가작업 그리고 808개의 파일을 삭제
  1. 0 32
      examcloud-config-center-starter/pom.xml
  2. 0 141
      examcloud-config-center-starter/src/main/java/cn/com/qmth/examcloud/config/center/ConfigCenterStarter.java
  3. 0 25
      examcloud-config-center-starter/src/main/java/cn/com/qmth/examcloud/config/center/configuration/ExamCloudAppSelf.java
  4. 0 23
      examcloud-config-center-starter/src/main/java/cn/com/qmth/examcloud/config/center/configuration/ExamCloudWebMvcConfigurer.java
  5. 0 86
      examcloud-config-center-starter/src/main/java/cn/com/qmth/examcloud/config/center/controller/ConfigCenterController.java
  6. 0 61
      examcloud-config-center-starter/src/main/java/cn/com/qmth/examcloud/config/center/core/BootstrapSecurityManager.java
  7. 0 113
      examcloud-config-center-starter/src/main/java/cn/com/qmth/examcloud/config/center/core/CommandInterpreter.java
  8. 0 110
      examcloud-config-center-starter/src/main/java/cn/com/qmth/examcloud/config/center/core/ConfigCenterBootstrap.java
  9. 0 85
      examcloud-config-center-starter/src/main/java/cn/com/qmth/examcloud/config/center/core/PropertiesLoader.java
  10. 0 49
      examcloud-config-center-starter/src/main/java/cn/com/qmth/examcloud/config/center/test/Rpc.java
  11. 0 13
      examcloud-config-center-starter/src/main/java/cn/com/qmth/examcloud/config/center/test/Test.java
  12. 0 14
      examcloud-config-center-starter/src/main/java/cn/com/qmth/examcloud/config/center/test/Test2.java
  13. 0 55
      examcloud-config-center-starter/src/main/resources/log4j2.xml
  14. 0 1
      pom.xml

+ 0 - 32
examcloud-config-center-starter/pom.xml

@@ -1,32 +0,0 @@
-<?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>examcloud-config-center-starter</artifactId>
-    <packaging>jar</packaging>
-
-    <parent>
-        <groupId>cn.com.qmth.examcloud</groupId>
-        <artifactId>examcloud-components</artifactId>
-        <version>${revision}</version>
-    </parent>
-
-    <dependencies>
-        <dependency>
-            <groupId>cn.com.qmth.examcloud</groupId>
-            <artifactId>examcloud-web</artifactId>
-            <version>${project.version}</version>
-            <exclusions>
-                <exclusion>
-                    <groupId>org.springframework.cloud</groupId>
-                    <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
-            <groupId>org.jline</groupId>
-            <artifactId>jline</artifactId>
-        </dependency>
-    </dependencies>
-
-</project>

+ 0 - 141
examcloud-config-center-starter/src/main/java/cn/com/qmth/examcloud/config/center/ConfigCenterStarter.java

@@ -1,141 +0,0 @@
-package cn.com.qmth.examcloud.config.center;
-
-import cn.com.qmth.examcloud.commons.helpers.BlackHolePrintStreamBuilder;
-import cn.com.qmth.examcloud.commons.logging.ExamCloudLog;
-import cn.com.qmth.examcloud.commons.logging.ExamCloudLogFactory;
-import cn.com.qmth.examcloud.config.center.core.BootstrapSecurityManager;
-import cn.com.qmth.examcloud.config.center.core.CommandInterpreter;
-import cn.com.qmth.examcloud.config.center.core.ConfigCenterBootstrap;
-import org.apache.commons.compress.utils.IOUtils;
-import org.apache.commons.lang3.ArrayUtils;
-import org.apache.logging.log4j.ThreadContext;
-import org.jline.reader.LineReader;
-import org.jline.reader.LineReaderBuilder;
-import org.jline.terminal.Terminal;
-import org.jline.terminal.TerminalBuilder;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
-import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.context.annotation.Configuration;
-
-import java.io.IOException;
-import java.io.PrintStream;
-import java.util.concurrent.TimeUnit;
-
-/**
- * 配置中心启动类
- *
- * @author WANGWEI
- * @date 2019年3月29日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-@SpringBootApplication(exclude = {RedisAutoConfiguration.class, DataSourceAutoConfiguration.class})
-@ComponentScan(basePackages = {"cn.com.qmth"})
-public class ConfigCenterStarter {
-
-    private static PrintStream stdOut = null;
-
-    private static PrintStream stdErrOut = null;
-
-    private static PrintStream blackHoleOut = null;
-
-    private static Long action = System.currentTimeMillis();
-
-    /**
-     * 启动方法
-     */
-    public static void run(String[] args) {
-        ExamCloudLog log = ExamCloudLogFactory.getLog(ConfigCenterStarter.class);
-        ThreadContext.put("TRACE_ID", Thread.currentThread().getName());
-        log.info("Starting...");
-
-        blackHoleOut = BlackHolePrintStreamBuilder.build();
-        stdOut = System.out;
-        stdErrOut = System.err;
-
-        Terminal terminal = null;
-        LineReader reader = null;
-        try {
-            System.setOut(blackHoleOut);
-            System.setErr(blackHoleOut);
-            terminal = TerminalBuilder.terminal();
-            reader = LineReaderBuilder.builder().terminal(terminal).build();
-            System.setOut(stdOut);
-            System.setErr(stdErrOut);
-        } catch (IOException e) {
-            System.setOut(stdOut);
-            System.setErr(stdErrOut);
-            IOUtils.closeQuietly(terminal);
-            e.printStackTrace();
-            System.exit(-1);
-        }
-
-        int errCount = 1;
-
-        String secretKey;
-        while (true) {
-            try {
-                secretKey = reader.readLine("Enter secret key>", (char) 0);
-                System.setOut(blackHoleOut);
-                System.setErr(blackHoleOut);
-                args = ArrayUtils.add(args, "--examcloud.startup.secretKey=" + secretKey);
-
-                ConfigCenterBootstrap.run(ConfigCenterStarter.class, args);
-                System.setOut(stdOut);
-                System.setErr(stdErrOut);
-                break;
-            } catch (Exception e) {
-                System.setOut(stdOut);
-                System.setErr(stdErrOut);
-                System.out.println(e.getMessage());
-
-                if (errCount > 5) {
-                    System.out.println("Too many wrong, exit!");
-                    System.exit(0);
-                }
-
-                System.out.println("Try again...");
-                errCount++;
-                continue;
-            }
-        }
-
-        System.out.println("Ok, running...");
-        String active = BootstrapSecurityManager.getInstance().getActive();
-        System.out.println("Env active = " + active);
-
-        new Thread(() -> {
-            while (true) {
-                if (System.currentTimeMillis() - action > CommandInterpreter.getInstance()
-                        .getSessionTimeout()) {
-                    System.exit(0);
-                }
-                try {
-                    TimeUnit.SECONDS.sleep(5);
-                } catch (InterruptedException e) {
-                    e.printStackTrace();
-                }
-            }
-
-        }).start();
-
-        IOUtils.closeQuietly(blackHoleOut);
-        action = System.currentTimeMillis();
-
-        while (true) {
-            action = System.currentTimeMillis();
-            String cmd = reader.readLine("$>");
-            if (cmd.equals("exit") || cmd.equals("quit")) {
-                break;
-            }
-
-            CommandInterpreter.getInstance().interpret(cmd);
-        }
-
-        IOUtils.closeQuietly(terminal);
-        System.exit(0);
-    }
-
-}

+ 0 - 25
examcloud-config-center-starter/src/main/java/cn/com/qmth/examcloud/config/center/configuration/ExamCloudAppSelf.java

@@ -1,25 +0,0 @@
-package cn.com.qmth.examcloud.config.center.configuration;
-
-import org.springframework.stereotype.Component;
-
-import cn.com.qmth.examcloud.web.cloud.AppSelf;
-
-@Component
-public class ExamCloudAppSelf implements AppSelf {
-
-	@Override
-	public Long getAppId() {
-		return -1L;
-	}
-
-	@Override
-	public String getSecretKey() {
-		return null;
-	}
-
-	@Override
-	public String getAppCode() {
-		return "CC";
-	}
-
-}

+ 0 - 23
examcloud-config-center-starter/src/main/java/cn/com/qmth/examcloud/config/center/configuration/ExamCloudWebMvcConfigurer.java

@@ -1,23 +0,0 @@
-package cn.com.qmth.examcloud.config.center.configuration;
-
-import cn.com.qmth.examcloud.web.interceptor.FirstInterceptor;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
-
-/**
- * WebMvcConfigurer
- *
- * @author WANGWEI
- * @date 2019年1月30日
- * @Copyright (c) 2018-2020 http://www.qmth.com.cn/ All Rights Reserved.
- */
-@Configuration
-public class ExamCloudWebMvcConfigurer implements WebMvcConfigurer {
-
-    @Override
-    public void addInterceptors(InterceptorRegistry registry) {
-        registry.addInterceptor(new FirstInterceptor()).addPathPatterns("/**");
-    }
-
-}

+ 0 - 86
examcloud-config-center-starter/src/main/java/cn/com/qmth/examcloud/config/center/controller/ConfigCenterController.java

@@ -1,86 +0,0 @@
-package cn.com.qmth.examcloud.config.center.controller;
-
-import java.util.Map;
-
-import javax.servlet.http.HttpServletResponse;
-
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-
-import cn.com.qmth.examcloud.commons.logging.ExamCloudLog;
-import cn.com.qmth.examcloud.commons.logging.ExamCloudLogFactory;
-import cn.com.qmth.examcloud.commons.util.JsonUtil;
-import cn.com.qmth.examcloud.config.center.core.BootstrapSecurityManager;
-import cn.com.qmth.examcloud.config.center.core.PropertiesLoader;
-import cn.com.qmth.examcloud.web.bootstrap.BootstrapSecurityUtil;
-import io.swagger.annotations.ApiOperation;
-
-@Controller
-@RequestMapping("configCenter")
-public class ConfigCenterController {
-
-	private static ExamCloudLog log = ExamCloudLogFactory.getLog("APP_STARTUP_LOGGER");
-
-	@ApiOperation(value = "消息通知")
-	@PostMapping("notice")
-	public ResponseEntity<String> notice(@RequestParam(required = true) String active,
-			@RequestParam(required = true) String appCode,
-			@RequestParam(required = true) String startupCode,
-			@RequestParam(required = true) String message) {
-
-		String mainInfo = "notice(). active=" + active + "; appCode=" + appCode + "; startupCode="
-				+ startupCode + "; message=" + message;
-		log.debug(mainInfo);
-
-		String configCenterActive = BootstrapSecurityManager.getInstance().getActive();
-		if (!configCenterActive.equals(active)) {
-			log.error("active is wrong");
-			return new ResponseEntity<>("active is wrong", HttpStatus.INTERNAL_SERVER_ERROR);
-		}
-
-		return new ResponseEntity<String>("OK", HttpStatus.OK);
-	}
-
-	@ApiOperation(value = "启动请求")
-	@PostMapping("startup")
-	public ResponseEntity<String> startup(@RequestParam(required = true) String active,
-			@RequestParam(required = true) String appCode,
-			@RequestParam(required = true) String startupCode, HttpServletResponse response) {
-
-		String mainInfo = "startup(). active=" + active + "; appCode=" + appCode + "; startupCode="
-				+ startupCode;
-
-		log.debug(mainInfo);
-
-		String configCenterActive = BootstrapSecurityManager.getInstance().getActive();
-		if (!configCenterActive.equals(active)) {
-			log.error("active is wrong");
-			return new ResponseEntity<>("active is wrong", HttpStatus.INTERNAL_SERVER_ERROR);
-		}
-
-		Map<String, String> map = null;
-		try {
-			map = PropertiesLoader.getProperties(appCode, active);
-		} catch (Exception e) {
-			log.error(e.getMessage());
-			return new ResponseEntity<>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
-		}
-
-		String ret = JsonUtil.toJson(map);
-		ret = BootstrapSecurityUtil.encrypt(ret, startupCode);
-
-		String appId = map.get("examcloud.bootstrap.app.appId");
-		String secretKey = map.get("examcloud.bootstrap.app.secretKey");
-
-		response.setHeader("App-Id", BootstrapSecurityUtil.encrypt(appId, startupCode));
-		response.setHeader("App-Code", appCode);
-		response.setHeader("Secret-Key", BootstrapSecurityUtil.encrypt(secretKey, startupCode));
-
-		return new ResponseEntity<>(ret, HttpStatus.OK);
-	}
-
-}

+ 0 - 61
examcloud-config-center-starter/src/main/java/cn/com/qmth/examcloud/config/center/core/BootstrapSecurityManager.java

@@ -1,61 +0,0 @@
-package cn.com.qmth.examcloud.config.center.core;
-
-/**
- * 启动安全管理器
- *
- * @author WANGWEI
- * @date 2019年3月25日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-public class BootstrapSecurityManager {
-
-	private static BootstrapSecurityManager mgr;
-
-	private static final Object LOCK = new Object();
-
-	private String secretKey;
-
-	private String active;
-
-	/**
-	 * 构造函数
-	 */
-	private BootstrapSecurityManager() {
-	}
-
-	/**
-	 * 获取单例
-	 *
-	 * @author WANGWEI
-	 * @return
-	 */
-	public static BootstrapSecurityManager getInstance() {
-		if (null == mgr) {
-			synchronized (LOCK) {
-				if (null == mgr) {
-					mgr = new BootstrapSecurityManager();
-				}
-				return mgr;
-			}
-		} else {
-			return mgr;
-		}
-	}
-
-	public String getSecretKey() {
-		return secretKey;
-	}
-
-	public void setSecretKey(String secretKey) {
-		this.secretKey = secretKey;
-	}
-
-	public String getActive() {
-		return active;
-	}
-
-	public void setActive(String active) {
-		this.active = active;
-	}
-
-}

+ 0 - 113
examcloud-config-center-starter/src/main/java/cn/com/qmth/examcloud/config/center/core/CommandInterpreter.java

@@ -1,113 +0,0 @@
-package cn.com.qmth.examcloud.config.center.core;
-
-import cn.com.qmth.examcloud.commons.logging.ExamCloudLog;
-import cn.com.qmth.examcloud.commons.logging.ExamCloudLogFactory;
-import cn.com.qmth.examcloud.commons.util.MapUtil;
-import cn.com.qmth.examcloud.commons.util.RegExpUtil;
-import cn.com.qmth.examcloud.commons.util.StringUtil;
-import org.apache.commons.lang3.StringUtils;
-
-import java.util.Map;
-import java.util.Map.Entry;
-
-/**
- * 命令解释器
- *
- * @author WANGWEI
- * @date 2018年12月5日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-public class CommandInterpreter {
-
-    private static ExamCloudLog log = ExamCloudLogFactory.getLog("COMMAND_LOGGER");
-
-    private static CommandInterpreter interpreter;
-
-    private static final Object LOCK = new Object();
-
-    private static long sessionTimeout = 1000 * 60 * 10;
-
-    /**
-     * 构造函数
-     */
-    private CommandInterpreter() {
-
-    }
-
-    /**
-     * 获取单例
-     */
-    public static CommandInterpreter getInstance() {
-        if (null == interpreter) {
-            synchronized (LOCK) {
-                if (null == interpreter) {
-                    interpreter = new CommandInterpreter();
-                }
-                return interpreter;
-            }
-        } else {
-            return interpreter;
-        }
-    }
-
-    /**
-     * 解释
-     */
-    public void interpret(String cmd) {
-        try {
-            process(cmd);
-        } catch (Exception e) {
-            log.error(e.getMessage());
-        }
-    }
-
-    /**
-     * 处理
-     */
-    public void process(String cmd) {
-        cmd = cmd.trim();
-        if (StringUtils.isBlank(cmd)) {
-            return;
-        }
-
-        if (cmd.matches("\\s*session\\s+[1-9]\\d*")) {
-            // 设置进程退出命令:session 分钟值
-            String timeoutStr = RegExpUtil.find(cmd, "\\s*session\\s+([1-9]\\d*)", 1);
-            timeoutStr = timeoutStr.length() > 4 ? "999" : timeoutStr;
-
-            // 默认最大值
-            long timeout = StringUtil.toLong(timeoutStr);
-            timeout = timeout > 360 ? 360 : timeout;
-
-            sessionTimeout = 1000 * 60 * timeout;
-            log.info("sessionTimeout = " + timeout + " minutes");
-        } else if (cmd.matches("\\s*load\\s+([^\\s]+)\\s*")) {
-            // 加载配置:load <appSimpleName>
-            String appSimpleName = RegExpUtil.find(cmd, "\\s*load\\s+([^\\s]+)\\s*", 1);
-            String active = BootstrapSecurityManager.getInstance().getActive();
-            Map<String, String> properties = PropertiesLoader.getProperties(appSimpleName, active);
-
-            properties = MapUtil.sortMapByKey(properties, true);
-            StringBuilder props = new StringBuilder()
-                    .append(appSimpleName)
-                    .append(" ")
-                    .append(active)
-                    .append(" Properties: ");
-
-            for (Entry<String, String> entry : properties.entrySet()) {
-                props.append("\n  ").append(entry.getKey()).append("=").append(entry.getValue());
-            }
-
-            log.info(props.toString());
-        } else {
-            // 错误命令
-            log.error("error command !");
-        }
-
-    }
-
-    public long getSessionTimeout() {
-        return sessionTimeout;
-    }
-
-}

+ 0 - 110
examcloud-config-center-starter/src/main/java/cn/com/qmth/examcloud/config/center/core/ConfigCenterBootstrap.java

@@ -1,110 +0,0 @@
-package cn.com.qmth.examcloud.config.center.core;
-
-import cn.com.qmth.examcloud.commons.logging.ExamCloudLog;
-import cn.com.qmth.examcloud.commons.logging.ExamCloudLogFactory;
-import cn.com.qmth.examcloud.commons.util.PropertiesUtil;
-import cn.com.qmth.examcloud.web.bootstrap.BootstrapSecurityUtil;
-import com.google.common.collect.Sets;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.boot.SpringApplication;
-import org.springframework.context.ConfigurableApplicationContext;
-
-import java.util.Map.Entry;
-import java.util.Properties;
-import java.util.Set;
-
-/**
- * 配置中心启动器
- *
- * @author WANGWEI
- * @date 2019年3月25日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-public class ConfigCenterBootstrap {
-
-    private static ExamCloudLog log = ExamCloudLogFactory.getLog(ConfigCenterBootstrap.class);
-
-    /**
-     * 启动配置中心
-     */
-    public static ConfigurableApplicationContext run(Class<?> primarySource, String... args) {
-
-        Properties props = new Properties();
-        PropertiesUtil.loadFromResource("application.properties", props);
-
-        String active = null;
-        String secretKey = null;
-        if (null != args) {
-            for (String s : args) {
-                s = s.trim();
-                if (s.startsWith("--examcloud.startup.secretKey=")) {
-                    secretKey = s.substring(s.indexOf("=") + 1);
-                }
-                if (s.startsWith("--spring.profiles.active=")) {
-                    active = s.substring(s.indexOf("=") + 1);
-                }
-            }
-        }
-
-        if (null == active) {
-            String value = props.getProperty("spring.profiles.active");
-            if (StringUtils.isNotBlank(value)) {
-                active = value.trim();
-            }
-        }
-        log.info("active=" + active);
-
-        if (StringUtils.isBlank(active)) {
-            log.error("[spring.profiles.active] value must not empty!");
-            System.exit(-1);
-        }
-
-        if (StringUtils.isBlank(secretKey)) {
-            throw new RuntimeException("Secret key must not empty!");
-        }
-
-        PropertiesUtil.loadFromResource("application-" + active + ".properties", props);
-        props.setProperty("spring.profiles.active", active);
-
-        String test = props.getProperty("$$.examcloud.test");
-        if (StringUtils.isBlank(test)) {
-            log.error("[$$.examcloud.test] value must not empty!");
-            System.exit(-1);
-        }
-
-        try {
-            BootstrapSecurityUtil.decrypt(test.trim(), secretKey);
-        } catch (Exception e) {
-            throw new RuntimeException("Secret key is wrong!");
-        }
-
-        try {
-            BootstrapSecurityUtil.decrypt(props, secretKey);
-        } catch (Exception e) {
-            log.error("Secret key decrypt fail!");
-            System.exit(-1);
-        }
-
-        Set<String> argSet = Sets.newLinkedHashSet();
-        for (Entry<Object, Object> p : props.entrySet()) {
-            String arg = "--" + p.getKey() + "=" + p.getValue();
-            argSet.add(arg);
-        }
-
-        String[] newArgs = argSet.toArray(new String[argSet.size()]);
-
-        BootstrapSecurityManager.getInstance().setSecretKey(secretKey);
-        BootstrapSecurityManager.getInstance().setActive(active);
-
-        ConfigurableApplicationContext context = null;
-        try {
-            context = SpringApplication.run(primarySource, newArgs);
-        } catch (Exception e) {
-            log.error("Project startup fail!", e);
-            System.exit(-1);
-        }
-
-        return context;
-    }
-
-}

+ 0 - 85
examcloud-config-center-starter/src/main/java/cn/com/qmth/examcloud/config/center/core/PropertiesLoader.java

@@ -1,85 +0,0 @@
-package cn.com.qmth.examcloud.config.center.core;
-
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Properties;
-import java.util.Set;
-
-import org.apache.commons.lang3.StringUtils;
-
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-
-import cn.com.qmth.examcloud.commons.util.PropertiesUtil;
-import cn.com.qmth.examcloud.web.bootstrap.BootstrapSecurityUtil;
-
-/**
- * 配置加载器
- *
- * @author WANGWEI
- * @date 2019年5月15日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-public class PropertiesLoader {
-
-	/**
-	 * 保存启动配置属性
-	 *
-	 * @author WANGWEI
-	 * @param appCode
-	 * @param active
-	 */
-	public static Map<String, String> getProperties(String appCode, String active) {
-
-		Properties props = new Properties();
-		String resource1 = active + "/application.properties";
-		String resource2 = active + "/application-" + appCode + ".properties";
-
-		try {
-			PropertiesUtil.loadFromResource(resource1, props);
-		} catch (Exception e) {
-			String errorMessage = "fail to load properties file [" + resource1 + "]";
-			throw new RuntimeException(errorMessage);
-		}
-
-		BootstrapSecurityUtil.decrypt(props, BootstrapSecurityManager.getInstance().getSecretKey());
-
-		try {
-			PropertiesUtil.loadFromResource(resource2, props);
-		} catch (Exception e) {
-			String errorMessage = "fail to load properties file [" + resource2 + "]";
-			throw new RuntimeException(errorMessage);
-		}
-
-		BootstrapSecurityUtil.decrypt(props, BootstrapSecurityManager.getInstance().getSecretKey());
-
-		Map<String, String> map = Maps.newHashMap();
-		for (Entry<Object, Object> entry : props.entrySet()) {
-			map.put(String.valueOf(entry.getKey()), String.valueOf(entry.getValue()));
-		}
-
-		filter(map);
-		return map;
-	}
-
-	private static void filter(Map<String, String> properties) {
-		Set<String> removedKeySet = Sets.newHashSet();
-
-		String datasourceType = properties.get("spring.datasource.type");
-		if (StringUtils.isNotBlank(datasourceType)) {
-			if (datasourceType.equalsIgnoreCase("null")) {
-				for (String key : properties.keySet()) {
-					if (key.startsWith("spring.datasource")) {
-						removedKeySet.add(key);
-					}
-				}
-			}
-		}
-
-		for (String key : removedKeySet) {
-			properties.remove(key);
-		}
-
-	}
-
-}

+ 0 - 49
examcloud-config-center-starter/src/main/java/cn/com/qmth/examcloud/config/center/test/Rpc.java

@@ -1,49 +0,0 @@
-package cn.com.qmth.examcloud.config.center.test;
-
-import java.io.IOException;
-import java.util.Map;
-
-import com.google.common.collect.Maps;
-
-import cn.com.qmth.examcloud.commons.util.ByteUtil;
-import cn.com.qmth.examcloud.commons.util.HttpMethod;
-import cn.com.qmth.examcloud.commons.util.OKHttpUtil;
-import cn.com.qmth.examcloud.commons.util.SHA256;
-import cn.com.qmth.examcloud.commons.util.StringUtil;
-import cn.com.qmth.examcloud.commons.util.ThreadLocalUtil;
-import okhttp3.Response;
-
-/**
- * RPC
- *
- * @author WANGWEI
- * @date 2019年6月13日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-public class Rpc {
-
-	public static void main(String[] args) throws IOException {
-
-		Map<String, String> headers = Maps.newHashMap();
-		long startTime = System.currentTimeMillis();
-		String appId = "1";
-		String appCode = "B";
-		String secretKey = "123456";
-
-		headers.put("Trace-Id", ThreadLocalUtil.getTraceId());
-		headers.put("timestamp", String.valueOf(startTime));
-		headers.put("App-Id", appId);
-		headers.put("App-Code", appCode);
-
-		String joinStr = StringUtil.join(appId, appCode, startTime, secretKey);
-		byte[] bytes = SHA256.encode(joinStr);
-		String accessToken = ByteUtil.toHexAscii(bytes);
-		headers.put("Access-Token", accessToken);
-
-		String url = "http://192.168.10.39:8001/cache/refresh";
-		String reqBody = "{\"className\":\"cn.com.qmth.examcloud.core.examwork.service.cache.ExamOrgPropertyCache\",\"keys\":[\"a\",\"3\",\"WARN_THRESHOLD\"],\"typeArray\":[\"LONG\",\"LONG\",\"STRING\"]}";
-		Response response = OKHttpUtil.call(HttpMethod.POST, url, headers, reqBody);
-
-		System.out.println(response.body().string());
-	}
-}

+ 0 - 13
examcloud-config-center-starter/src/main/java/cn/com/qmth/examcloud/config/center/test/Test.java

@@ -1,13 +0,0 @@
-package cn.com.qmth.examcloud.config.center.test;
-
-import cn.com.qmth.examcloud.web.bootstrap.BootstrapSecurityUtil;
-
-public class Test {
-	public static void main(String[] args) {
-		String s = "";
-		String secretKey = "";
-		System.out.println(BootstrapSecurityUtil.encrypt(s, secretKey));
-		// System.out.println(BootstrapSecurityUtil.decrypt(s, secretKey));
-	}
-
-}

+ 0 - 14
examcloud-config-center-starter/src/main/java/cn/com/qmth/examcloud/config/center/test/Test2.java

@@ -1,14 +0,0 @@
-package cn.com.qmth.examcloud.config.center.test;
-
-import cn.com.qmth.examcloud.commons.util.ByteUtil;
-import cn.com.qmth.examcloud.commons.util.SHA256;
-
-public class Test2 {
-	public static void main(String[] args) {
-		String str1 = "1";
-		String str2 = "123456";
-		String encoded = ByteUtil.toHexAscii(SHA256.encode(str1 + str2));
-		System.out.println(encoded);
-	}
-
-}

+ 0 - 55
examcloud-config-center-starter/src/main/resources/log4j2.xml

@@ -1,55 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Configuration status="WARN" monitorInterval="30">
-
-    <Appenders>
-        <Console name="CONSOLE" target="SYSTEM_OUT">
-            <PatternLayout
-                    pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} | %level | %X{TRACE_ID} | %clr{%c{1.1}:%L}{cyan} | %m%n $>"
-                    charset="UTF-8"/>
-        </Console>
-
-        <Console name="APP_STARTUP_CONSOLE" target="SYSTEM_OUT">
-            <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} | %level | %X{TRACE_ID} | %m%n $>"
-                           charset="UTF-8"/>
-        </Console>
-
-        <Console name="COMMAND_CONSOLE" target="SYSTEM_OUT">
-            <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} | %level | CMD | %m%n"/>
-        </Console>
-    </Appenders>
-
-    <Loggers>
-        <logger name="springfox.documentation" level="ERROR"/>
-        <logger name="org.springframework" level="ERROR"/>
-        <logger name="org.hibernate" level="ERROR"/>
-        <logger name="org.apache" level="ERROR"/>
-        <logger name="org.quartz" level="ERROR"/>
-        <logger name="org.docx4j" level="ERROR"/>
-        <logger name="cn.afterturn" level="ERROR"/>
-        <logger name="com.netflix" level="ERROR"/>
-        <logger name="com.aliyun" level="ERROR"/>
-        <logger name="io.lettuce" level="ERROR"/>
-        <logger name="io.netty" level="ERROR"/>
-
-        <Logger name="APP_STARTUP_LOGGER" level="DEBUG" additivity="false">
-            <AppenderRef ref="APP_STARTUP_CONSOLE"/>
-        </Logger>
-
-        <Logger name="COMMAND_LOGGER" level="DEBUG" additivity="false">
-            <AppenderRef ref="COMMAND_CONSOLE"/>
-        </Logger>
-
-        <Logger name="INTERFACE_LOGGER" level="DEBUG" additivity="false">
-            <AppenderRef ref="CONSOLE"/>
-        </Logger>
-
-        <Logger name="cn.com.qmth.examcloud" level="DEBUG" additivity="false">
-            <AppenderRef ref="CONSOLE"/>
-        </Logger>
-
-        <Root level="DEBUG">
-            <AppenderRef ref="CONSOLE"/>
-        </Root>
-    </Loggers>
-
-</Configuration>

+ 0 - 1
pom.xml

@@ -19,7 +19,6 @@
         <module>examcloud-question-commons</module>
         <module>examcloud-support</module>
         <module>examcloud-reports-commons</module>
-        <module>examcloud-config-center-starter</module>
         <module>examcloud-starters</module>
     </modules>