feat():行数据测试
parent
d6aca9b11b
commit
8ca8c5071b
|
@ -34,7 +34,6 @@ public class FilesCompilerLoad {
|
||||||
|
|
||||||
public static Result<Object> javaCompiler(String fileName){
|
public static Result<Object> javaCompiler(String fileName){
|
||||||
|
|
||||||
|
|
||||||
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
||||||
String[] strings = {"-classpath","/home/lib","-verbose","-d", "/home/lib","home/"+fileName + MethodSuffix.JAVASUFFIX };
|
String[] strings = {"-classpath","/home/lib","-verbose","-d", "/home/lib","home/"+fileName + MethodSuffix.JAVASUFFIX };
|
||||||
// 执行编译任务
|
// 执行编译任务
|
||||||
|
@ -46,8 +45,6 @@ public class FilesCompilerLoad {
|
||||||
System.out.println("编译失败");
|
System.out.println("编译失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return Result.success();
|
return Result.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@ public class OSSFileLoad {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 从OSS下载文件
|
// 从OSS下载文件
|
||||||
|
log.info("下载OSS文件:{}",fileName + MethodSuffix.JAVASUFFIX);
|
||||||
InputStream inputStream = ossClient.getObject(bucketName, fileJavaPath + fileName + MethodSuffix.JAVASUFFIX).getObjectContent();
|
InputStream inputStream = ossClient.getObject(bucketName, fileJavaPath + fileName + MethodSuffix.JAVASUFFIX).getObjectContent();
|
||||||
File downloadFile = new File(localPath);
|
File downloadFile = new File(localPath);
|
||||||
FileOutputStream outputStream = new FileOutputStream(downloadFile);
|
FileOutputStream outputStream = new FileOutputStream(downloadFile);
|
||||||
|
|
|
@ -168,7 +168,7 @@ public class RuleVersionController {
|
||||||
public Result<String> row(
|
public Result<String> row(
|
||||||
@Validated @RequestBody DataRecord dataRecord){
|
@Validated @RequestBody DataRecord dataRecord){
|
||||||
ruleVersionService.rowTest(dataRecord);
|
ruleVersionService.rowTest(dataRecord);
|
||||||
return Result.success();
|
return Result.success(null,"测试成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,19 +102,22 @@ public class RuleVersionServiceImpl
|
||||||
public void rowTest(DataRecord dataRecord) {
|
public void rowTest(DataRecord dataRecord) {
|
||||||
|
|
||||||
//上传java文件
|
//上传java文件
|
||||||
ALiYunUpload.uploadJavaFiles(dataRecord.getRuleVersionTest(),dataRecord.getRuleVersionType());
|
log.info("上传OSS:java文件");
|
||||||
|
Result<Object> objectResult = ALiYunUpload.uploadJavaFiles(dataRecord.getRuleVersionTest(), dataRecord.getRuleVersionType());
|
||||||
|
log.info(objectResult.getData());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
System.out.println("执行编译");
|
|
||||||
OSSFileLoad.streamingJavaDownload(dataRecord.getRuleVersionType());
|
OSSFileLoad.streamingJavaDownload(dataRecord.getRuleVersionType());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.info(e.getMessage());
|
log.info(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
//编译class
|
//编译class
|
||||||
|
System.out.println("执行编译");
|
||||||
FilesCompilerLoad.javaCompiler(dataRecord.getRuleVersionType());
|
FilesCompilerLoad.javaCompiler(dataRecord.getRuleVersionType());
|
||||||
|
|
||||||
//上传class
|
//上传class
|
||||||
|
log.info("上传OSS:class文件");
|
||||||
ALiYunUpload.uploadClassFiles(
|
ALiYunUpload.uploadClassFiles(
|
||||||
dataRecord.getRuleVersionType(),
|
dataRecord.getRuleVersionType(),
|
||||||
ClassPath+dataRecord.getRuleVersionType()+ MethodSuffix.CLASSSUFFIX);
|
ClassPath+dataRecord.getRuleVersionType()+ MethodSuffix.CLASSSUFFIX);
|
||||||
|
@ -135,7 +138,6 @@ public class RuleVersionServiceImpl
|
||||||
try {
|
try {
|
||||||
Object instance = clazz.getDeclaredConstructor().newInstance();
|
Object instance = clazz.getDeclaredConstructor().newInstance();
|
||||||
|
|
||||||
|
|
||||||
engineRecordMap.put(dataRecord.getRuleVersionType(), (BasicEngine<DataRecord>) instance);
|
engineRecordMap.put(dataRecord.getRuleVersionType(), (BasicEngine<DataRecord>) instance);
|
||||||
|
|
||||||
} catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
|
} catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
|
||||||
|
@ -157,6 +159,7 @@ public class RuleVersionServiceImpl
|
||||||
dataValues[2].setValue("20");
|
dataValues[2].setValue("20");
|
||||||
|
|
||||||
dataRecord.setDataValues(dataValues);
|
dataRecord.setDataValues(dataValues);
|
||||||
|
log.info("测试数据:[{}]",dataRecord.getDataValues());
|
||||||
|
|
||||||
BasicEngine<DataRecord> engine = engineRecordMap.get(dataRecord.getRuleVersionType());
|
BasicEngine<DataRecord> engine = engineRecordMap.get(dataRecord.getRuleVersionType());
|
||||||
engine.set(dataRecord.getDataValues()[3]);
|
engine.set(dataRecord.getDataValues()[3]);
|
||||||
|
|
Loading…
Reference in New Issue