-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow list customer location (#2534)
* add allow feature * add classpath allow list * format code * fix check
- Loading branch information
Showing
12 changed files
with
135 additions
and
19 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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 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
65 changes: 65 additions & 0 deletions
65
g11n-ws/vip-manager-i18n/src/test/java/com/vmware/vip/i18n/l3/ProductServiceTest.java
This file contains 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,65 @@ | ||
/* | ||
* Copyright 2019-2023 VMware, Inc. | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package com.vmware.vip.i18n.l3; | ||
|
||
import com.vmware.vip.BootApplication; | ||
import com.vmware.vip.core.messages.service.product.IProductService; | ||
import org.apache.commons.io.FileUtils; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.test.context.junit4.SpringRunner; | ||
import org.springframework.web.context.WebApplicationContext; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.util.Map; | ||
|
||
@RunWith(SpringRunner.class) | ||
@SpringBootTest(classes = BootApplication.class) | ||
public class ProductServiceTest { | ||
@Autowired | ||
private WebApplicationContext webApplicationContext; | ||
@Autowired | ||
private IProductService iProductService; | ||
private static String testList1 = "classpath:bundle_unittest.json"; | ||
private static String testList2 = "bundle_unittest.json"; | ||
private static String testList2_content = "{\n" + | ||
" \"unitTest\":[\"1.0.0\",\"2.0.0\"]\n" + | ||
"}"; | ||
private static Logger logger = LoggerFactory.getLogger(ProductServiceTest.class); | ||
|
||
@Test | ||
public void testProductAllowList1(){ | ||
Map<String, Object> result = iProductService.getAllowProductList(testList1); | ||
logger.info(String.valueOf(result.size())); | ||
Assert.assertTrue(result.size()>0); | ||
} | ||
|
||
@Test | ||
public void testProductAllowList2(){ | ||
File file = new File(testList2); | ||
file.deleteOnExit(); | ||
try { | ||
file.createNewFile(); | ||
FileUtils.write(file, testList2_content, "UTF-8"); | ||
Map<String, Object> result = iProductService.getAllowProductList(file.getAbsolutePath()); | ||
logger.info(String.valueOf(result.size())); | ||
Assert.assertTrue(result.size()>0); | ||
file.deleteOnExit(); | ||
} catch (IOException e) { | ||
logger.error(e.getMessage(), e); | ||
} | ||
|
||
|
||
|
||
} | ||
|
||
|
||
} |
3 changes: 3 additions & 0 deletions
3
g11n-ws/vip-manager-i18n/src/test/resources/bundle_unittest.json
This file contains 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,3 @@ | ||
{ | ||
"unitTest":["1.0.0","2.0.0"] | ||
} |