mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
code optimize (#2107)
* admin assembly打包 * 修改npm profile * code optimize * code optimize
This commit is contained in:
@@ -138,22 +138,22 @@ public class SimpleAdminConnector implements AdminConnector {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean check() {
|
public boolean check() {
|
||||||
return BooleanUtils.toBoolean(Integer.valueOf(doServerAdmin("check")));
|
return BooleanUtils.toBoolean(Integer.parseInt(doServerAdmin("check")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean start() {
|
public boolean start() {
|
||||||
return BooleanUtils.toBoolean(Integer.valueOf(doServerAdmin("start")));
|
return BooleanUtils.toBoolean(Integer.parseInt(doServerAdmin("start")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean stop() {
|
public boolean stop() {
|
||||||
return BooleanUtils.toBoolean(Integer.valueOf(doServerAdmin("stop")));
|
return BooleanUtils.toBoolean(Integer.parseInt(doServerAdmin("stop")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean restart() {
|
public boolean restart() {
|
||||||
return BooleanUtils.toBoolean(Integer.valueOf(doServerAdmin("restart")));
|
return BooleanUtils.toBoolean(Integer.parseInt(doServerAdmin("restart")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -163,22 +163,22 @@ public class SimpleAdminConnector implements AdminConnector {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkInstance(String destination) {
|
public boolean checkInstance(String destination) {
|
||||||
return BooleanUtils.toBoolean(Integer.valueOf(doInstanceAdmin(destination, "check")));
|
return BooleanUtils.toBoolean(Integer.parseInt(doInstanceAdmin(destination, "check")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean startInstance(String destination) {
|
public boolean startInstance(String destination) {
|
||||||
return BooleanUtils.toBoolean(Integer.valueOf(doInstanceAdmin(destination, "start")));
|
return BooleanUtils.toBoolean(Integer.parseInt(doInstanceAdmin(destination, "start")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean stopInstance(String destination) {
|
public boolean stopInstance(String destination) {
|
||||||
return BooleanUtils.toBoolean(Integer.valueOf(doInstanceAdmin(destination, "stop")));
|
return BooleanUtils.toBoolean(Integer.parseInt(doInstanceAdmin(destination, "stop")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean restartInstance(String destination) {
|
public boolean restartInstance(String destination) {
|
||||||
return BooleanUtils.toBoolean(Integer.valueOf(doInstanceAdmin(destination, "restart")));
|
return BooleanUtils.toBoolean(Integer.parseInt(doInstanceAdmin(destination, "restart")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ public class PollingConfigController {
|
|||||||
|
|
||||||
CanalInstanceConfig canalInstanceConfig = new CanalInstanceConfig();
|
CanalInstanceConfig canalInstanceConfig = new CanalInstanceConfig();
|
||||||
List<CanalInstanceConfig> configs = canalInstanceConfigService.findList(canalInstanceConfig);
|
List<CanalInstanceConfig> configs = canalInstanceConfigService.findList(canalInstanceConfig);
|
||||||
List<String> instances = configs.stream().map(config -> config.getName()).collect(Collectors.toList());
|
List<String> instances = configs.stream().map(CanalInstanceConfig::getName).collect(Collectors.toList());
|
||||||
String data = Joiner.on(',').join(instances);
|
String data = Joiner.on(',').join(instances);
|
||||||
canalInstanceConfig.setContent(data);
|
canalInstanceConfig.setContent(data);
|
||||||
if (StringUtils.isEmpty(md5)) {
|
if (StringUtils.isEmpty(md5)) {
|
||||||
|
|||||||
@@ -26,6 +26,9 @@ public class UserServiceImpl implements UserService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
User user = User.find.query().where().eq("username", username).findOne();
|
User user = User.find.query().where().eq("username", username).findOne();
|
||||||
|
if (user == null) {
|
||||||
|
throw new ServiceException("user:" + username + " auth failed!");
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
byte[] pass = SecurityUtil.scramble411(password.getBytes(), seeds);
|
byte[] pass = SecurityUtil.scramble411(password.getBytes(), seeds);
|
||||||
if (!SecurityUtil.scrambleServerAuth(pass, SecurityUtil.hexStr2Bytes(user.getPassword()), seeds)) {
|
if (!SecurityUtil.scrambleServerAuth(pass, SecurityUtil.hexStr2Bytes(user.getPassword()), seeds)) {
|
||||||
@@ -35,9 +38,7 @@ public class UserServiceImpl implements UserService {
|
|||||||
throw new ServiceException("user:" + user.getName() + " auth failed!");
|
throw new ServiceException("user:" + user.getName() + " auth failed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user != null) {
|
|
||||||
user.setPassword("");
|
user.setPassword("");
|
||||||
}
|
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,12 @@ import java.io.IOException;
|
|||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import com.alibaba.otter.canal.parse.driver.mysql.packets.server.ResultSetPacket;
|
import com.alibaba.otter.canal.parse.driver.mysql.packets.server.ResultSetPacket;
|
||||||
|
|
||||||
|
@Ignore
|
||||||
public class MysqlConnectorTest {
|
public class MysqlConnectorTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user