update: add ApiConifg2appsServiceTests
This commit is contained in:
@@ -56,13 +56,7 @@ public class ApiConifg2appsService {
|
|||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() throws Throwable {
|
public void init() throws Throwable {
|
||||||
rt.opsForHash().entries(fizzApiConfigAppSetSize)
|
rt.opsForHash().entries(fizzApiConfigAppSetSize)
|
||||||
.reduce(
|
.collectList()
|
||||||
new ArrayList<Map.Entry<Object, Object>>(),
|
|
||||||
(collector, e) -> {
|
|
||||||
collector.add(e);
|
|
||||||
return collector;
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.map(
|
.map(
|
||||||
es -> {
|
es -> {
|
||||||
log(es);
|
log(es);
|
||||||
@@ -76,13 +70,7 @@ public class ApiConifg2appsService {
|
|||||||
o -> {
|
o -> {
|
||||||
return
|
return
|
||||||
rt.opsForSet().members(fizzApiConfigAppKeyPrefix + apiConfigId + '_' + iFinal)
|
rt.opsForSet().members(fizzApiConfigAppKeyPrefix + apiConfigId + '_' + iFinal)
|
||||||
.reduce(
|
.collectList()
|
||||||
new ArrayList<String>(),
|
|
||||||
(collector, a) -> {
|
|
||||||
collector.add(a);
|
|
||||||
return collector;
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.map(
|
.map(
|
||||||
as -> {
|
as -> {
|
||||||
save(apiConfigId, as);
|
save(apiConfigId, as);
|
||||||
@@ -108,7 +96,7 @@ public class ApiConifg2appsService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void log(ArrayList<Map.Entry<Object, Object>> es) {
|
private void log(List<Map.Entry<Object, Object>> es) {
|
||||||
StringBuilder b = ThreadContext.getStringBuilder();
|
StringBuilder b = ThreadContext.getStringBuilder();
|
||||||
b.append(fizzApiConfigAppSetSize).append('\n');
|
b.append(fizzApiConfigAppSetSize).append('\n');
|
||||||
for (Map.Entry<Object, Object> e : es) {
|
for (Map.Entry<Object, Object> e : es) {
|
||||||
@@ -119,7 +107,7 @@ public class ApiConifg2appsService {
|
|||||||
log.info(b.toString());
|
log.info(b.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void save(Integer apiConfigId, ArrayList<String> as) {
|
private void save(Integer apiConfigId, List<String> as) {
|
||||||
Set<String> appSet = apiConfig2appsMap.get(apiConfigId);
|
Set<String> appSet = apiConfig2appsMap.get(apiConfigId);
|
||||||
if (appSet == null) {
|
if (appSet == null) {
|
||||||
appSet = new HashSet<>();
|
appSet = new HashSet<>();
|
||||||
@@ -129,7 +117,7 @@ public class ApiConifg2appsService {
|
|||||||
log(apiConfigId, as);
|
log(apiConfigId, as);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void log(Integer apiConfigId, ArrayList<String> apps) {
|
private void log(Integer apiConfigId, List<String> apps) {
|
||||||
StringBuilder b = ThreadContext.getStringBuilder();
|
StringBuilder b = ThreadContext.getStringBuilder();
|
||||||
b.append(apiConfigId).append(" add: ");
|
b.append(apiConfigId).append(" add: ");
|
||||||
for (String a : apps) {
|
for (String a : apps) {
|
||||||
|
|||||||
Reference in New Issue
Block a user