xiongzhu 4 년 전
부모
커밋
41a03acca9
1개의 변경된 파일9개의 추가작업 그리고 20개의 파일을 삭제
  1. 9 20
      src/test/java/com/izouma/nineth/service/CollectionServiceTest.java

+ 9 - 20
src/test/java/com/izouma/nineth/service/CollectionServiceTest.java

@@ -50,10 +50,10 @@ class CollectionServiceTest extends ApplicationTests {
 
     @Test
     public void batchUpload() throws IOException {
-        AtomicInteger num = new AtomicInteger(1);
+        AtomicInteger num = new AtomicInteger(2001);
         List<BlindBoxItem> items = new ArrayList<>();
         String jsonStr = FileUtils.readFileToString(new File("/Users/drew/Downloads/003.json"), "UTF-8");
-        Arrays.stream(new File("/Users/drew/Downloads/MAYBEMAN套装池2000张").listFiles())
+        Arrays.stream(new File("/Users/drew/Downloads/s3-1000").listFiles())
                 .filter(f -> Pattern.matches("^BJ.*\\.png$", f.getName()))
                 .parallel().forEach(file -> {
                     try {
@@ -66,7 +66,7 @@ class CollectionServiceTest extends ApplicationTests {
                         collection.setMinterId(8666L);
                         collection.setOnShelf(false);
                         collection.setSalable(false);
-                        collection.setPic(Collections.singletonList(new FileObject("", "https://raex-meta.oss-cn-shenzhen.aliyuncs.com/image/MAYBEMAN/" + file.getName(), null, "png")));
+                        collection.setPic(Collections.singletonList(new FileObject("", "https://raex-meta.oss-cn-shenzhen.aliyuncs.com/image/s3/" + file.getName(), null, "png")));
 
                         collectionRepo.save(collection);
 
@@ -86,7 +86,10 @@ class CollectionServiceTest extends ApplicationTests {
 
     @Test
     public void createBlindBox() throws IOException {
-        List<Collection> items = collectionRepo.findByNameLike("MAYBEMAN #%");
+        List<Collection> items = collectionRepo.findByNameLike("MAYBEMAN #%").stream().filter(i -> {
+            int num = Integer.parseInt(i.getName().substring("MAYBEMAN #".length()));
+            return num > 2000 && num <= 3000;
+        }).collect(Collectors.toList());
 
         String jsonStr = FileUtils.readFileToString(new File("/Users/drew/Downloads/003.json"), "UTF-8");
         Collection blindBox = JSON.parseObject(jsonStr, Collection.class);
@@ -95,29 +98,15 @@ class CollectionServiceTest extends ApplicationTests {
         blindBox.setOnShelf(false);
         blindBox.setSalable(false);
         blindBox.setMinterId(8666L);
-        blindBox.setName("MAYBEMAN潮流艺术限定盲盒S1");
+        blindBox.setName("MAYBEMAN潮流艺术限定盲盒S3");
         blindBox.setPic(Arrays.asList(new FileObject(null, "https://raex-meta.oss-cn-shenzhen.aliyuncs.com/nft/2022-01-07-10-08-30DpIYYBOv.jpg", null, null)));
-        collectionService.createBlindBox(new CreateBlindBox(blindBox, items.subList(0, 1000).stream().map(i -> {
+        collectionService.createBlindBox(new CreateBlindBox(blindBox, items.stream().map(i -> {
             BlindBoxItem item = new BlindBoxItem();
             item.setCollectionId(i.getId());
             item.setTotal(1);
             return item;
         }).collect(Collectors.toList())));
 
-        Collection blindBox1 = JSON.parseObject(jsonStr, Collection.class);
-        blindBox1.setType(CollectionType.BLIND_BOX);
-        blindBox1.setId(null);
-        blindBox1.setOnShelf(false);
-        blindBox1.setSalable(false);
-        blindBox1.setMinterId(8666L);
-        blindBox1.setName("MAYBEMAN潮流艺术限定盲盒S2");
-        blindBox1.setPic(Arrays.asList(new FileObject(null, "https://raex-meta.oss-cn-shenzhen.aliyuncs.com/nft/2022-01-07-10-08-30DpIYYBOv.jpg", null, null)));
-        collectionService.createBlindBox(new CreateBlindBox(blindBox1, items.subList(1000, 2000).stream().map(i -> {
-            BlindBoxItem item = new BlindBoxItem();
-            item.setCollectionId(i.getId());
-            item.setTotal(1);
-            return item;
-        }).collect(Collectors.toList())));
     }
 
     public FileObject uploadFile(File file) throws IOException {