You've already forked FrameTour-BE
52 lines
1.7 KiB
Java
52 lines
1.7 KiB
Java
package com.ycwl.basic.facebody.adapter;
|
|
|
|
import com.ycwl.basic.facebody.entity.AliFaceBodyConfig;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.junit.Test;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
import static org.junit.jupiter.api.Assertions.*;
|
|
|
|
public class AliFaceBodyAdapterTest {
|
|
private AliFaceBodyAdapter getAdapter() {
|
|
AliFaceBodyAdapter adapter = new AliFaceBodyAdapter();
|
|
AliFaceBodyConfig config = new AliFaceBodyConfig();
|
|
config.setAccessKeyId("LTAI5tMwrmxVcUEKoH5QzLHx");
|
|
config.setAccessKeySecret("ZCIP8aKx1jwX1wkeYIPQEDZ8fPtN1c");
|
|
config.setRegion("cn-shanghai");
|
|
adapter.setConfig(config);
|
|
return adapter;
|
|
};
|
|
@Test
|
|
public void test() {
|
|
// String dbName = "3940097994925412352";
|
|
String dbName = "3975985126059413504";
|
|
AliFaceBodyAdapter adapter = getAdapter();
|
|
while (true) {
|
|
AtomicInteger count = new AtomicInteger(0);
|
|
List<String> strings = adapter.listFace(dbName, "", 0, 200);
|
|
if (strings == null || strings.isEmpty()) {
|
|
continue;
|
|
}
|
|
for (String s : strings) {
|
|
if (StringUtils.contains(s, "_")) {
|
|
count.incrementAndGet();
|
|
System.out.println(s);
|
|
adapter.deleteFace(dbName, s);
|
|
}
|
|
}
|
|
if (count.get() == 0) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
@Test
|
|
public void testDeleteDb() {
|
|
AliFaceBodyAdapter adapter = getAdapter();
|
|
adapter.deleteFaceDb("userFace3972138108618674176");
|
|
}
|
|
} |