feat():行数据测试

master
yuan 2024-09-08 10:08:42 +08:00
parent d6aca9b11b
commit 8ca8c5071b
4 changed files with 8 additions and 7 deletions

View File

@ -34,7 +34,6 @@ public class FilesCompilerLoad {
public static Result<Object> javaCompiler(String fileName){
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
String[] strings = {"-classpath","/home/lib","-verbose","-d", "/home/lib","home/"+fileName + MethodSuffix.JAVASUFFIX };
// 执行编译任务
@ -46,8 +45,6 @@ public class FilesCompilerLoad {
System.out.println("编译失败");
}
return Result.success();
}

View File

@ -51,6 +51,7 @@ public class OSSFileLoad {
try {
// 从OSS下载文件
log.info("下载OSS文件:{}",fileName + MethodSuffix.JAVASUFFIX);
InputStream inputStream = ossClient.getObject(bucketName, fileJavaPath + fileName + MethodSuffix.JAVASUFFIX).getObjectContent();
File downloadFile = new File(localPath);
FileOutputStream outputStream = new FileOutputStream(downloadFile);

View File

@ -168,7 +168,7 @@ public class RuleVersionController {
public Result<String> row(
@Validated @RequestBody DataRecord dataRecord){
ruleVersionService.rowTest(dataRecord);
return Result.success();
return Result.success(null,"测试成功");
}
}

View File

@ -102,19 +102,22 @@ public class RuleVersionServiceImpl
public void rowTest(DataRecord dataRecord) {
//上传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 {
System.out.println("执行编译");
OSSFileLoad.streamingJavaDownload(dataRecord.getRuleVersionType());
} catch (IOException e) {
log.info(e.getMessage());
}
//编译class
System.out.println("执行编译");
FilesCompilerLoad.javaCompiler(dataRecord.getRuleVersionType());
//上传class
log.info("上传OSS:class文件");
ALiYunUpload.uploadClassFiles(
dataRecord.getRuleVersionType(),
ClassPath+dataRecord.getRuleVersionType()+ MethodSuffix.CLASSSUFFIX);
@ -135,7 +138,6 @@ public class RuleVersionServiceImpl
try {
Object instance = clazz.getDeclaredConstructor().newInstance();
engineRecordMap.put(dataRecord.getRuleVersionType(), (BasicEngine<DataRecord>) instance);
} catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
@ -157,6 +159,7 @@ public class RuleVersionServiceImpl
dataValues[2].setValue("20");
dataRecord.setDataValues(dataValues);
log.info("测试数据:[{}]",dataRecord.getDataValues());
BasicEngine<DataRecord> engine = engineRecordMap.get(dataRecord.getRuleVersionType());
engine.set(dataRecord.getDataValues()[3]);