[ISSUE #11847] fix OpenApi publish Cas fail (#11850)

* 修复openApi publishConfigCas失效

* 修复openApi publishConfigCas失效

* fix unit test
This commit is contained in:
zhanghong 2024-04-01 15:32:33 +08:00 committed by GitHub
parent 5fcef225be
commit 25585d65dd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 3 deletions

View File

@ -88,7 +88,10 @@ public class ConfigOperationService {
ConfigInfo configInfo = new ConfigInfo(configForm.getDataId(), configForm.getGroup(),
configForm.getNamespaceId(), configForm.getAppName(), configForm.getContent());
//set old md5
if (StringUtils.isNotBlank(configRequestInfo.getCasMd5())) {
configInfo.setMd5(configRequestInfo.getCasMd5());
}
configInfo.setType(configForm.getType());
configInfo.setEncryptedDataKey(encryptedDataKey);
ConfigOperateResult configOperateResult;

View File

@ -614,7 +614,7 @@ public class EmbeddedConfigInfoPersistServiceImpl implements ConfigInfoPersistSe
context.putWhereParameter(FieldConstant.MD5, configInfo.getMd5());
MapperResult mapperResult = configInfoMapper.updateConfigInfoAtomicCas(context);
EmbeddedStorageContextHolder.addSqlContext(mapperResult.getSql(), mapperResult.getParamList().toArray());
EmbeddedStorageContextHolder.addSqlContext(Boolean.TRUE, mapperResult.getSql(), mapperResult.getParamList().toArray());
return getConfigInfoOperateResult(configInfo.getDataId(), configInfo.getGroup(), tenantTmp);
}

View File

@ -351,7 +351,7 @@ public class EmbeddedConfigInfoPersistServiceImplTest {
embeddedConfigInfoPersistService.insertOrUpdateCas(srcIp, srcUser, configInfo, configAdvanceInfo);
//expect update config info invoked.
embeddedStorageContextHolderMockedStatic.verify(
() -> EmbeddedStorageContextHolder.addSqlContext(anyString(), eq(content),
() -> EmbeddedStorageContextHolder.addSqlContext(eq(Boolean.TRUE), anyString(), eq(content),
eq(MD5Utils.md5Hex(content, Constants.PERSIST_ENCODE)), eq(srcIp), eq(srcUser),
any(Timestamp.class), eq(appName), eq(desc), eq(use), eq(effect), eq(type), eq(schema),
eq(encryptedDataKey), eq(dataId), eq(group), eq(tenant), eq(casMd5)), times(1));