diff options
author | Leif Åstrand <leif@vaadin.com> | 2014-12-18 18:30:09 +0200 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2014-12-18 18:30:09 +0200 |
commit | e3d0fbbab68f9ef8642a975741d9f576993b1f38 (patch) | |
tree | 5711a31c5af1d3773a86b4d25c9f8064aa435ecc /client-compiler/tests/src/com/vaadin/tools/CvalCheckerTest.java | |
parent | 434fb5bf5cf62490686367e9193b7898077bbd44 (diff) | |
parent | 68eec666b55c42b4a55235c00bc78f6212eb2062 (diff) | |
download | vaadin-framework-e3d0fbbab68f9ef8642a975741d9f576993b1f38.tar.gz vaadin-framework-e3d0fbbab68f9ef8642a975741d9f576993b1f38.zip |
Merge remote-tracking branch 'origin/master' into grid
Change-Id: Ic7629f9cedb3c948edf4f63c678ca499e3d52805
Diffstat (limited to 'client-compiler/tests/src/com/vaadin/tools/CvalCheckerTest.java')
-rw-r--r-- | client-compiler/tests/src/com/vaadin/tools/CvalCheckerTest.java | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/client-compiler/tests/src/com/vaadin/tools/CvalCheckerTest.java b/client-compiler/tests/src/com/vaadin/tools/CvalCheckerTest.java index 2985f61631..64a38fae2e 100644 --- a/client-compiler/tests/src/com/vaadin/tools/CvalCheckerTest.java +++ b/client-compiler/tests/src/com/vaadin/tools/CvalCheckerTest.java @@ -66,9 +66,14 @@ public class CvalCheckerTest { static final String responseJson = "{'licenseKey':'" + VALID_KEY + "'," + "'licensee':'Test User','type':'normal'," - + "'expiredEpoch':'1893511225000'," + "'product':{'name':'" + + "'expiredEpoch':1893511225000," + "'product':{'name':'" + productNameCval + "', 'version': 2}}"; + static final String responseJsonWithNullVersion = "{'licenseKey':'" + VALID_KEY + "'," + + "'licensee':'Test User','type':'normal'," + + "'expiredEpoch':1893511225000," + "'product':{'name':'" + + productNameCval + "', 'version': null}}"; + private static ByteArrayOutputStream outContent; // A provider returning a valid license if productKey is valid or null if @@ -114,7 +119,7 @@ public class CvalCheckerTest { static final CvalServer unlimitedLicenseProvider = new CvalServer() { @Override String askServer(String productName, String productKey, int timeout) { - return responseJson.replaceFirst("1893511225000", ""); + return responseJson.replaceFirst("1893511225000", "null"); } }; // An unreachable provider @@ -128,6 +133,14 @@ public class CvalCheckerTest { return super.askServer(productName, productKey, 1000); } }; + // A provider with 'null' in the version field + static final CvalServer nullVersionLicenseProvider = new CvalServer() { + @Override + String askServer(String productName, String productKey, int timeout) + throws IOException { + return responseJsonWithNullVersion; + } + }; private CvalChecker licenseChecker; private String licenseName; @@ -245,6 +258,7 @@ public class CvalCheckerTest { Assert.assertTrue(cacheExists(productNameCval)); // Check an unlimited license + deleteCache(productNameCval); licenseChecker.setLicenseProvider(unlimitedLicenseProvider); licenseChecker .validateProduct(productNameCval, "2.1", productTitleCval); @@ -262,6 +276,12 @@ public class CvalCheckerTest { assertEquals(productNameCval, expected.name); } Assert.assertTrue(cacheExists(productNameCval)); + + deleteCache(productNameCval); + licenseChecker.setLicenseProvider(nullVersionLicenseProvider); + licenseChecker + .validateProduct(productNameCval, "2.1", productTitleCval); + Assert.assertTrue(cacheExists(productNameCval)); } /* @@ -282,8 +302,7 @@ public class CvalCheckerTest { testManifest.getMainAttributes().putValue(VAADIN_ADDON_VERSION, "2"); // Create a temporary Jar - String tmpDir = System.getProperty("java.io.tmpdir"); - File testJarFile = new File(tmpDir + "vaadin." + productName + ".jar"); + File testJarFile = File.createTempFile("vaadin." + productName, "jar"); testJarFile.deleteOnExit(); JarOutputStream target = new JarOutputStream(new FileOutputStream( testJarFile), testManifest); |