-
Notifications
You must be signed in to change notification settings - Fork 42
The eigenvalues are recalculated through configuration #125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
98c3d7f
feat: noise
pangdayuan1 8a33b2f
Merge remote-tracking branch 'origin/main' into feat/setting
pangdayuan1 e7c385f
feat: The eigenvalues are recalculated through configuration
pangdayuan1 1248d57
feat: The eigenvalues are recalculated through configuration
pangdayuan1 17f9c32
Merge remote-tracking branch 'origin/main' into feat/setting
pangdayuan1 67c086a
feat: The eigenvalues are recalculated through configuration
pangdayuan1 4f75c92
feat: The eigenvalues are recalculated through configuration
pangdayuan1 9415fbe
feat: The eigenvalues are recalculated through configuration
pangdayuan1 3b6769e
Merge remote-tracking branch 'origin/main' into feat/setting
pangdayuan1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
arex-storage-config/src/main/java/com/arextest/config/model/vo/QueryConfigOfCategory.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.arextest.config.model.vo; | ||
|
||
import lombok.Data; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
|
||
/** | ||
* created by xinyuan_wang on 2023/12/4 | ||
*/ | ||
@Data | ||
public class QueryConfigOfCategory { | ||
private String operationName; | ||
|
||
private Set<List<String>> exclusionList; | ||
|
||
private Set<String> ignoreNodeSet; | ||
} |
23 changes: 23 additions & 0 deletions
23
...orage-config/src/main/java/com/arextest/config/model/vo/QueryConfigOfCategoryRequest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.arextest.config.model.vo; | ||
|
||
import lombok.Data; | ||
|
||
import javax.validation.constraints.NotEmpty; | ||
import javax.validation.constraints.NotNull; | ||
|
||
/** | ||
* created by xinyuan_wang on 2023/12/4 | ||
*/ | ||
@Data | ||
public class QueryConfigOfCategoryRequest { | ||
|
||
@NotNull | ||
private String appId; | ||
|
||
private String operationName; | ||
|
||
private String categoryName; | ||
|
||
@NotEmpty | ||
private Boolean entryPoint; | ||
} |
11 changes: 11 additions & 0 deletions
11
...rage-config/src/main/java/com/arextest/config/model/vo/QueryConfigOfCategoryResponse.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.arextest.config.model.vo; | ||
|
||
import lombok.Data; | ||
|
||
/** | ||
* created by xinyuan_wang on 2023/12/4 | ||
*/ | ||
@Data | ||
public class QueryConfigOfCategoryResponse { | ||
private QueryConfigOfCategory body; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
arex-storage-web-api/src/main/java/com/arextest/storage/service/QueryConfigService.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package com.arextest.storage.service; | ||
|
||
import com.arextest.common.cache.CacheProvider; | ||
import com.arextest.config.model.vo.QueryConfigOfCategory; | ||
import com.arextest.config.model.vo.QueryConfigOfCategoryRequest; | ||
import com.arextest.config.model.vo.QueryConfigOfCategoryResponse; | ||
import com.arextest.model.mock.Mocker; | ||
import com.arextest.storage.cache.CacheKeyUtils; | ||
import com.arextest.storage.client.HttpWepServiceApiClient; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.stereotype.Service; | ||
|
||
import javax.annotation.Resource; | ||
|
||
import static com.arextest.diff.utils.JacksonHelperUtil.objectMapper; | ||
|
||
/** | ||
* query config service | ||
* created by xinyuan_wang on 2023/11/5 | ||
*/ | ||
@Service | ||
@Slf4j | ||
public class QueryConfigService { | ||
private static final String CONFIG_PREFIX = "config_"; | ||
@Value("${arex.query.config.url}") | ||
private String queryConfigOfCategoryUrl; | ||
@Value("${arex.query.config.cache.expired.seconds:600}") | ||
private long cacheExpiredSeconds; | ||
@Resource | ||
private HttpWepServiceApiClient httpWepServiceApiClient; | ||
@Resource | ||
private CacheProvider redisCacheProvider; | ||
|
||
public QueryConfigOfCategory queryConfigOfCategory(Mocker mocker) { | ||
if (mocker.getCategoryType().isSkipComparison()) { | ||
return null; | ||
} | ||
QueryConfigOfCategory configCache = getConfigCache(mocker.getAppId(), mocker.getOperationName()); | ||
if (configCache != null) { | ||
return null; | ||
} | ||
|
||
QueryConfigOfCategoryRequest queryConfigOfCategoryRequest = new QueryConfigOfCategoryRequest(); | ||
queryConfigOfCategoryRequest.setCategoryName(mocker.getCategoryType().getName()); | ||
queryConfigOfCategoryRequest.setAppId(mocker.getAppId()); | ||
queryConfigOfCategoryRequest.setEntryPoint(mocker.getCategoryType().isEntryPoint()); | ||
queryConfigOfCategoryRequest.setOperationName(mocker.getOperationName()); | ||
QueryConfigOfCategoryResponse queryConfigOfCategoryResponse = | ||
httpWepServiceApiClient.jsonPost(queryConfigOfCategoryUrl, queryConfigOfCategoryRequest, QueryConfigOfCategoryResponse.class); | ||
if (queryConfigOfCategoryResponse != null && queryConfigOfCategoryResponse.getBody() != null) { | ||
putConfigCache(mocker.getAppId(), mocker.getOperationName(), queryConfigOfCategoryResponse.getBody()); | ||
return queryConfigOfCategoryResponse.getBody(); | ||
} | ||
return null; | ||
} | ||
|
||
public boolean putConfigCache(String appId, String operationName, QueryConfigOfCategory response) { | ||
try { | ||
byte[] key = CacheKeyUtils.toUtf8Bytes(CONFIG_PREFIX + appId + operationName); | ||
byte[] values = CacheKeyUtils.toUtf8Bytes(objectMapper.writeValueAsString(response)); | ||
redisCacheProvider.put(key, cacheExpiredSeconds, values); | ||
return true; | ||
} catch (Exception e) { | ||
LOGGER.error("putConfigCache failed!", e); | ||
return false; | ||
} | ||
} | ||
|
||
public QueryConfigOfCategory getConfigCache(String appId, String operationName) { | ||
try { | ||
byte[] key = CacheKeyUtils.toUtf8Bytes(CONFIG_PREFIX + appId + operationName); | ||
byte[] values = redisCacheProvider.get(key); | ||
if (values == null) { | ||
return null; | ||
} | ||
return objectMapper.readValue(new String(values), QueryConfigOfCategory.class); | ||
} catch (Exception e) { | ||
LOGGER.error("getConfigCache failed!", e); | ||
return null; | ||
} | ||
} | ||
|
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.