diff options
author | Artur Signell <artur@vaadin.com> | 2016-08-18 09:27:03 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2016-08-18 09:27:03 +0300 |
commit | 6d54d78944f6c3278eed3bb5e7ee19687ee5714e (patch) | |
tree | 8142f622e644e98bb3f8d19a7021fd125f9fed40 /client-compiler/src/test | |
parent | 7b899665d07be33f86015f71695868c70bc5a589 (diff) | |
download | vaadin-framework-6d54d78944f6c3278eed3bb5e7ee19687ee5714e.tar.gz vaadin-framework-6d54d78944f6c3278eed3bb5e7ee19687ee5714e.zip |
Format using Eclipse Neon
Change-Id: I33f1cc33969ff74a95b1b8cc0f2add589be5aae0
Diffstat (limited to 'client-compiler/src/test')
3 files changed, 54 insertions, 55 deletions
diff --git a/client-compiler/src/test/java/com/vaadin/tools/CvalAddonsCheckerTest.java b/client-compiler/src/test/java/com/vaadin/tools/CvalAddonsCheckerTest.java index c6200bc7e0..c706f0b9e0 100644 --- a/client-compiler/src/test/java/com/vaadin/tools/CvalAddonsCheckerTest.java +++ b/client-compiler/src/test/java/com/vaadin/tools/CvalAddonsCheckerTest.java @@ -54,8 +54,8 @@ public class CvalAddonsCheckerTest { @Before public void setup() { - addonChecker = new CvalAddonsChecker().setLicenseProvider( - validLicenseProvider).setFilter(".*test.*"); + addonChecker = new CvalAddonsChecker() + .setLicenseProvider(validLicenseProvider).setFilter(".*test.*"); licenseName = computeLicenseName(productNameCval); deleteCache(productNameCval); diff --git a/client-compiler/src/test/java/com/vaadin/tools/CvalAddonstCheckerUseCasesTest.java b/client-compiler/src/test/java/com/vaadin/tools/CvalAddonstCheckerUseCasesTest.java index 01cfe2087e..82962663f2 100644 --- a/client-compiler/src/test/java/com/vaadin/tools/CvalAddonstCheckerUseCasesTest.java +++ b/client-compiler/src/test/java/com/vaadin/tools/CvalAddonstCheckerUseCasesTest.java @@ -76,7 +76,7 @@ public class CvalAddonstCheckerUseCasesTest { enum Message { AGPL("AGPL"), VALID(">.* valid"), INVALID("not valid"), NO_LICENSE( "not found"), NO_VALIDATED("has not been validated"), EXPIRED( - "has expired"), EVALUATION("evaluation"); + "has expired"), EVALUATION("evaluation"); String msg; @@ -93,7 +93,7 @@ public class CvalAddonstCheckerUseCasesTest { } /* TODO: Use more descriptive test names */ - + @Test public void testUseCase1() throws Exception { useCase(1, License.NONE, Version.AGPL, Validated.NO, Network.OFF, @@ -219,8 +219,8 @@ public class CvalAddonstCheckerUseCasesTest { if (val == Validated.NO) { deleteCache(productNameCval); } else { - String type = lic == License.EVAL || lic == License.EVAL_EXPIRED ? "evaluation" - : null; + String type = lic == License.EVAL || lic == License.EVAL_EXPIRED + ? "evaluation" : null; Boolean expired = lic == License.EVAL_EXPIRED || lic == License.REAL_EXPIRED ? true : null; String key = val == Validated.OLD_KEY ? "oldkey" : null; @@ -253,17 +253,16 @@ public class CvalAddonstCheckerUseCasesTest { restoreSystemOut(); message = e.getMessage(); if (res == Compile.YES) { - Assert.fail(testNumber + "Unexpected Exception: " - + e.getMessage()); + Assert.fail( + testNumber + "Unexpected Exception: " + e.getMessage()); } } // System.err.println("\n> " + testNumber + " " + lic + " " + ver + " " // + val + " " + net + " " + res + " " + cached + "\n" + message); - Assert.assertTrue(testNumber + "Fail:\n" + message - + "\nDoes not match:" + msg.msg, - message.matches("(?s).*" + msg.msg + ".*")); + Assert.assertTrue(testNumber + "Fail:\n" + message + "\nDoes not match:" + + msg.msg, message.matches("(?s).*" + msg.msg + ".*")); String c = cachedPreferences(productNameCval); Assert.assertTrue(testNumber + "Fail: cacheExists != " diff --git a/client-compiler/src/test/java/com/vaadin/tools/CvalCheckerTest.java b/client-compiler/src/test/java/com/vaadin/tools/CvalCheckerTest.java index 6e1a8e57ed..8333449a78 100644 --- a/client-compiler/src/test/java/com/vaadin/tools/CvalCheckerTest.java +++ b/client-compiler/src/test/java/com/vaadin/tools/CvalCheckerTest.java @@ -96,9 +96,8 @@ public class CvalCheckerTest { static final CvalServer expiredLicenseProviderWithMessage = new CvalServer() { @Override String askServer(String productName, String productKey, int timeout) { - return responseJson - .replace("'expired", - "'message':'Custom\\\\nServer\\\\nMessage','expired':true,'expired"); + return responseJson.replace("'expired", + "'message':'Custom\\\\nServer\\\\nMessage','expired':true,'expired"); } }; // A provider returning an expired license with a server message @@ -205,15 +204,15 @@ public class CvalCheckerTest { // Success if license key and version are valid System.setProperty(licenseName, VALID_KEY); - licenseChecker - .validateProduct(productNameCval, "2.1", productTitleCval); + licenseChecker.validateProduct(productNameCval, "2.1", + productTitleCval); Assert.assertTrue(cacheExists(productNameCval)); // Success if license and cache file are valid, although the license // server is offline licenseChecker.setLicenseProvider(unreachableLicenseProvider); - licenseChecker - .validateProduct(productNameCval, "2.1", productTitleCval); + licenseChecker.validateProduct(productNameCval, "2.1", + productTitleCval); Assert.assertTrue(cacheExists(productNameCval)); // Fail if license key changes although cache file were validated @@ -262,8 +261,8 @@ public class CvalCheckerTest { // Check an unlimited license deleteCache(productNameCval); licenseChecker.setLicenseProvider(unlimitedLicenseProvider); - licenseChecker - .validateProduct(productNameCval, "2.1", productTitleCval); + licenseChecker.validateProduct(productNameCval, "2.1", + productTitleCval); Assert.assertTrue(cacheExists(productNameCval)); // Fail if expired flag does not come, but expired epoch is in the past @@ -281,8 +280,8 @@ public class CvalCheckerTest { deleteCache(productNameCval); licenseChecker.setLicenseProvider(nullVersionLicenseProvider); - licenseChecker - .validateProduct(productNameCval, "2.1", productTitleCval); + licenseChecker.validateProduct(productNameCval, "2.1", + productTitleCval); Assert.assertTrue(cacheExists(productNameCval)); } @@ -290,8 +289,8 @@ public class CvalCheckerTest { * Creates a new .jar file with a MANIFEST.MF with all vaadin license info * attributes set, and add the .jar to the classpath */ - static void addLicensedJarToClasspath(String productName, String licenseType) - throws Exception { + static void addLicensedJarToClasspath(String productName, + String licenseType) throws Exception { // Create a manifest with Vaadin CVAL license Manifest testManifest = new Manifest(); testManifest.getMainAttributes().putValue("Manifest-Version", "1.0"); @@ -306,8 +305,8 @@ public class CvalCheckerTest { // Create a temporary Jar File testJarFile = File.createTempFile("vaadin." + productName, ".jar"); testJarFile.deleteOnExit(); - JarOutputStream target = new JarOutputStream(new FileOutputStream( - testJarFile), testManifest); + JarOutputStream target = new JarOutputStream( + new FileOutputStream(testJarFile), testManifest); target.close(); // Add the new jar to our classpath (use reflection) @@ -362,7 +361,8 @@ public class CvalCheckerTest { } static void restoreSystemOut() { - System.setOut(new PrintStream(new FileOutputStream(FileDescriptor.out))); + System.setOut( + new PrintStream(new FileOutputStream(FileDescriptor.out))); } @Test(expected = FileNotFoundException.class) @@ -374,8 +374,8 @@ public class CvalCheckerTest { public void testReadKeyFromFile_LicenseFileEmpty() throws Exception { File tmpLicenseFile = File.createTempFile("license", "lic"); - assertNull(licenseChecker.readKeyFromFile(tmpLicenseFile.toURI() - .toURL(), 4)); + assertNull(licenseChecker + .readKeyFromFile(tmpLicenseFile.toURI().toURL(), 4)); tmpLicenseFile.delete(); } @@ -388,8 +388,8 @@ public class CvalCheckerTest { out.println("this-is-a-license"); out.close(); - assertEquals("this-is-a-license", licenseChecker.readKeyFromFile( - tmpLicenseFile.toURI().toURL(), 4)); + assertEquals("this-is-a-license", licenseChecker + .readKeyFromFile(tmpLicenseFile.toURI().toURL(), 4)); tmpLicenseFile.delete(); } @@ -402,8 +402,8 @@ public class CvalCheckerTest { out.println("4=this-is-a-license"); out.close(); - assertEquals("this-is-a-license", licenseChecker.readKeyFromFile( - tmpLicenseFile.toURI().toURL(), 4)); + assertEquals("this-is-a-license", licenseChecker + .readKeyFromFile(tmpLicenseFile.toURI().toURL(), 4)); tmpLicenseFile.delete(); } @@ -417,10 +417,10 @@ public class CvalCheckerTest { out.println("5=this-is-another-license"); out.close(); - assertEquals("this-is-a-license", licenseChecker.readKeyFromFile( - tmpLicenseFile.toURI().toURL(), 4)); - assertEquals("this-is-another-license", licenseChecker.readKeyFromFile( - tmpLicenseFile.toURI().toURL(), 5)); + assertEquals("this-is-a-license", licenseChecker + .readKeyFromFile(tmpLicenseFile.toURI().toURL(), 4)); + assertEquals("this-is-another-license", licenseChecker + .readKeyFromFile(tmpLicenseFile.toURI().toURL(), 5)); tmpLicenseFile.delete(); } @@ -434,10 +434,10 @@ public class CvalCheckerTest { out.println("5 = this-is-another-license"); out.close(); - assertEquals("this-is-a-license", licenseChecker.readKeyFromFile( - tmpLicenseFile.toURI().toURL(), 4)); - assertEquals("this-is-another-license", licenseChecker.readKeyFromFile( - tmpLicenseFile.toURI().toURL(), 5)); + assertEquals("this-is-a-license", licenseChecker + .readKeyFromFile(tmpLicenseFile.toURI().toURL(), 4)); + assertEquals("this-is-another-license", licenseChecker + .readKeyFromFile(tmpLicenseFile.toURI().toURL(), 5)); tmpLicenseFile.delete(); } @@ -450,8 +450,8 @@ public class CvalCheckerTest { out.println("5 = this-is-another-license"); out.close(); - assertNull(licenseChecker.readKeyFromFile(tmpLicenseFile.toURI() - .toURL(), 3)); + assertNull(licenseChecker + .readKeyFromFile(tmpLicenseFile.toURI().toURL(), 3)); tmpLicenseFile.delete(); } @@ -464,12 +464,12 @@ public class CvalCheckerTest { out.println("5 = this-is-another-license"); out.close(); - assertEquals("this-is-a-license", licenseChecker.readKeyFromFile( - tmpLicenseFile.toURI().toURL(), 3)); - assertEquals("this-is-a-license", licenseChecker.readKeyFromFile( - tmpLicenseFile.toURI().toURL(), 4)); - assertEquals("this-is-another-license", licenseChecker.readKeyFromFile( - tmpLicenseFile.toURI().toURL(), 5)); + assertEquals("this-is-a-license", licenseChecker + .readKeyFromFile(tmpLicenseFile.toURI().toURL(), 3)); + assertEquals("this-is-a-license", licenseChecker + .readKeyFromFile(tmpLicenseFile.toURI().toURL(), 4)); + assertEquals("this-is-another-license", licenseChecker + .readKeyFromFile(tmpLicenseFile.toURI().toURL(), 5)); tmpLicenseFile.delete(); } @@ -483,12 +483,12 @@ public class CvalCheckerTest { out.println("this-is-a-license"); out.close(); - assertEquals("this-is-a-license", licenseChecker.readKeyFromFile( - tmpLicenseFile.toURI().toURL(), 3)); - assertEquals("this-is-a-license", licenseChecker.readKeyFromFile( - tmpLicenseFile.toURI().toURL(), 4)); - assertEquals("this-is-another-license", licenseChecker.readKeyFromFile( - tmpLicenseFile.toURI().toURL(), 5)); + assertEquals("this-is-a-license", licenseChecker + .readKeyFromFile(tmpLicenseFile.toURI().toURL(), 3)); + assertEquals("this-is-a-license", licenseChecker + .readKeyFromFile(tmpLicenseFile.toURI().toURL(), 4)); + assertEquals("this-is-another-license", licenseChecker + .readKeyFromFile(tmpLicenseFile.toURI().toURL(), 5)); tmpLicenseFile.delete(); } |