aboutsummaryrefslogtreecommitdiffstats
path: root/client-compiler
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2016-08-18 09:27:03 +0300
committerArtur Signell <artur@vaadin.com>2016-08-18 09:27:03 +0300
commit6d54d78944f6c3278eed3bb5e7ee19687ee5714e (patch)
tree8142f622e644e98bb3f8d19a7021fd125f9fed40 /client-compiler
parent7b899665d07be33f86015f71695868c70bc5a589 (diff)
downloadvaadin-framework-6d54d78944f6c3278eed3bb5e7ee19687ee5714e.tar.gz
vaadin-framework-6d54d78944f6c3278eed3bb5e7ee19687ee5714e.zip
Format using Eclipse Neon
Change-Id: I33f1cc33969ff74a95b1b8cc0f2add589be5aae0
Diffstat (limited to 'client-compiler')
-rw-r--r--client-compiler/src/main/java/com/vaadin/sass/linker/SassLinker.java25
-rw-r--r--client-compiler/src/main/java/com/vaadin/server/widgetsetutils/AcceptCriteriaFactoryGenerator.java19
-rw-r--r--client-compiler/src/main/java/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java82
-rw-r--r--client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/ClientRpcVisitor.java15
-rw-r--r--client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java53
-rw-r--r--client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/FieldProperty.java9
-rw-r--r--client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/JsonSerializer.java4
-rw-r--r--client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/MethodProperty.java26
-rw-r--r--client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/Property.java12
-rw-r--r--client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/RendererVisitor.java37
-rw-r--r--client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/ServerRpcVisitor.java3
-rw-r--r--client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/StateInitVisitor.java4
-rw-r--r--client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/WidgetInitVisitor.java17
-rw-r--r--client-compiler/src/main/java/com/vaadin/tools/CvalAddonsChecker.java29
-rw-r--r--client-compiler/src/main/java/com/vaadin/tools/CvalChecker.java20
-rwxr-xr-xclient-compiler/src/main/java/com/vaadin/tools/WidgetsetCompiler.java4
-rw-r--r--client-compiler/src/test/java/com/vaadin/tools/CvalAddonsCheckerTest.java4
-rw-r--r--client-compiler/src/test/java/com/vaadin/tools/CvalAddonstCheckerUseCasesTest.java17
-rw-r--r--client-compiler/src/test/java/com/vaadin/tools/CvalCheckerTest.java88
19 files changed, 226 insertions, 242 deletions
diff --git a/client-compiler/src/main/java/com/vaadin/sass/linker/SassLinker.java b/client-compiler/src/main/java/com/vaadin/sass/linker/SassLinker.java
index dda6733384..02ad5f4896 100644
--- a/client-compiler/src/main/java/com/vaadin/sass/linker/SassLinker.java
+++ b/client-compiler/src/main/java/com/vaadin/sass/linker/SassLinker.java
@@ -109,30 +109,31 @@ public class SassLinker extends AbstractLinker {
// Store the file info for the compilation
scssFiles.add(new FileInfo(tempfile, partialPath));
} else {
- logger.log(TreeLogger.WARN, "Duplicate file "
- + tempfile.getPath());
+ logger.log(TreeLogger.WARN,
+ "Duplicate file " + tempfile.getPath());
}
} catch (IOException e) {
logger.log(TreeLogger.ERROR,
- "Could not write temporary file " + fileName, e);
+ "Could not write temporary file " + fileName,
+ e);
}
}
}
// Compile the files and store them in the artifact
- logger.log(TreeLogger.INFO, "Processing " + scssFiles.size()
- + " Sass file(s)");
+ logger.log(TreeLogger.INFO,
+ "Processing " + scssFiles.size() + " Sass file(s)");
for (FileInfo fileInfo : scssFiles) {
logger.log(TreeLogger.INFO, " " + fileInfo.originalScssPath
+ " -> " + fileInfo.getOriginalCssPath());
try {
- ScssStylesheet scss = ScssStylesheet.get(fileInfo
- .getAbsolutePath());
+ ScssStylesheet scss = ScssStylesheet
+ .get(fileInfo.getAbsolutePath());
if (!fileInfo.isMixin()) {
scss.compile();
- InputStream is = new ByteArrayInputStream(scss
- .printState().getBytes());
+ InputStream is = new ByteArrayInputStream(
+ scss.printState().getBytes());
toReturn.add(this.emitInputStream(logger, is,
fileInfo.getOriginalCssPath()));
@@ -143,10 +144,8 @@ public class SassLinker extends AbstractLinker {
logger.log(TreeLogger.ERROR, "SCSS compilation failed for "
+ fileInfo.getOriginalCssPath(), e);
} catch (IOException e) {
- logger.log(
- TreeLogger.ERROR,
- "Could not write CSS file for "
- + fileInfo.getOriginalCssPath(), e);
+ logger.log(TreeLogger.ERROR, "Could not write CSS file for "
+ + fileInfo.getOriginalCssPath(), e);
} catch (Exception e) {
logger.log(TreeLogger.ERROR, "SCSS compilation failed for "
+ fileInfo.getOriginalCssPath(), e);
diff --git a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/AcceptCriteriaFactoryGenerator.java b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/AcceptCriteriaFactoryGenerator.java
index 2d08329e9a..5ccbbc9d19 100644
--- a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/AcceptCriteriaFactoryGenerator.java
+++ b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/AcceptCriteriaFactoryGenerator.java
@@ -89,7 +89,8 @@ public class AcceptCriteriaFactoryGenerator extends Generator {
ClassSourceFileComposerFactory composer = null;
composer = new ClassSourceFileComposerFactory(packageName, className);
composer.addImport("com.google.gwt.core.client.GWT");
- composer.setSuperclass("com.vaadin.client.ui.dd.VAcceptCriterionFactory");
+ composer.setSuperclass(
+ "com.vaadin.client.ui.dd.VAcceptCriterionFactory");
SourceWriter sourceWriter = composer.createSourceWriter(context,
printWriter);
@@ -100,9 +101,8 @@ public class AcceptCriteriaFactoryGenerator extends Generator {
sourceWriter.println("}");
// commit generated class
context.commit(logger, printWriter);
- logger.log(Type.INFO,
- "Done. (" + (new Date().getTime() - date.getTime()) / 1000
- + "seconds)");
+ logger.log(Type.INFO, "Done. ("
+ + (new Date().getTime() - date.getTime()) / 1000 + "seconds)");
}
@@ -114,8 +114,8 @@ public class AcceptCriteriaFactoryGenerator extends Generator {
sourceWriter.println("name = name.intern();");
- JClassType criteriaType = context.getTypeOracle().findType(
- VAcceptCriterion.class.getName());
+ JClassType criteriaType = context.getTypeOracle()
+ .findType(VAcceptCriterion.class.getName());
JClassType[] subtypes = criteriaType.getSubtypes();
Arrays.sort(subtypes, ConnectorBundle.jClassComparator);
for (JClassType clientClass : subtypes) {
@@ -123,10 +123,11 @@ public class AcceptCriteriaFactoryGenerator extends Generator {
.getAnnotation(AcceptCriterion.class);
if (annotation != null) {
String clientClassName = clientClass.getQualifiedSourceName();
- Class<?> serverClass = clientClass.getAnnotation(
- AcceptCriterion.class).value();
+ Class<?> serverClass = clientClass
+ .getAnnotation(AcceptCriterion.class).value();
String serverClassName = serverClass.getCanonicalName();
- logger.log(Type.INFO, "creating mapping for " + serverClassName);
+ logger.log(Type.INFO,
+ "creating mapping for " + serverClassName);
sourceWriter.print("if (\"");
sourceWriter.print(serverClassName);
sourceWriter.print("\" == name) return GWT.create(");
diff --git a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java
index 2b8ccc87d0..510401e739 100644
--- a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java
+++ b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java
@@ -440,9 +440,10 @@ public class ConnectorBundleLoaderFactory extends Generator {
throw new UnableToCompleteException();
}
if (!property.hasAccessorMethods()) {
- logger.log(Type.ERROR, beanType.getQualifiedSourceName()
- + " has the property '" + name
- + "' without getter defined.");
+ logger.log(Type.ERROR,
+ beanType.getQualifiedSourceName()
+ + " has the property '" + name
+ + "' without getter defined.");
throw new UnableToCompleteException();
}
}
@@ -480,8 +481,9 @@ public class ConnectorBundleLoaderFactory extends Generator {
writer.print(
"store.@%s::setPropertyData(Ljava/lang/Class;Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)",
TypeDataStore.class.getName());
- writer.println("(@%s::class, '%s', data);", property.getBeanType()
- .getQualifiedSourceName(), property.getName());
+ writer.println("(@%s::class, '%s', data);",
+ property.getBeanType().getQualifiedSourceName(),
+ property.getName());
writer.println();
writer.splitIfNeeded(true,
String.format("%s store", TypeDataStore.class.getName()));
@@ -525,8 +527,7 @@ public class ConnectorBundleLoaderFactory extends Generator {
.entrySet()) {
JClassType connector = entry.getKey();
- TreeLogger typeLogger = logger.branch(
- Type.DEBUG,
+ TreeLogger typeLogger = logger.branch(Type.DEBUG,
"Generating @OnStateChange support for "
+ connector.getName());
@@ -544,9 +545,8 @@ public class ConnectorBundleLoaderFactory extends Generator {
"Processing method " + method.getName());
if (method.isPublic() || method.isProtected()) {
- methodLogger
- .log(Type.ERROR,
- "@OnStateChange is only supported for methods with private or default visibility.");
+ methodLogger.log(Type.ERROR,
+ "@OnStateChange is only supported for methods with private or default visibility.");
throw new UnableToCompleteException();
}
@@ -654,9 +654,8 @@ public class ConnectorBundleLoaderFactory extends Generator {
.entrySet()) {
JClassType beanType = entry.getKey();
for (Property property : entry.getValue()) {
- w.println(
- "store.setDelegateToWidget(%s, \"%s\", \"%s\");",
- getClassLiteralString(beanType),// property.getBeanType()),
+ w.println("store.setDelegateToWidget(%s, \"%s\", \"%s\");",
+ getClassLiteralString(beanType), // property.getBeanType()),
property.getName(),
property.getAnnotation(DelegateToWidget.class).value());
}
@@ -820,10 +819,12 @@ public class ConnectorBundleLoaderFactory extends Generator {
}
}
- private void writeParamTypes(SplittingSourceWriter w, ConnectorBundle bundle) {
+ private void writeParamTypes(SplittingSourceWriter w,
+ ConnectorBundle bundle) {
Map<JClassType, Set<JMethod>> needsParamTypes = bundle
.getNeedsParamTypes();
- for (Entry<JClassType, Set<JMethod>> entry : needsParamTypes.entrySet()) {
+ for (Entry<JClassType, Set<JMethod>> entry : needsParamTypes
+ .entrySet()) {
JClassType type = entry.getKey();
Set<JMethod> methods = entry.getValue();
@@ -864,8 +865,8 @@ public class ConnectorBundleLoaderFactory extends Generator {
w.print("\",");
if (method.isPublic()) {
- typeLogger.log(Type.DEBUG, "Invoking " + method.getName()
- + " using java");
+ typeLogger.log(Type.DEBUG,
+ "Invoking " + method.getName() + " using java");
writeJavaInvoker(w, type, method);
} else {
@@ -893,8 +894,8 @@ public class ConnectorBundleLoaderFactory extends Generator {
w.indent();
JType returnType = method.getReturnType();
- boolean hasReturnType = !"void".equals(returnType
- .getQualifiedSourceName());
+ boolean hasReturnType = !"void"
+ .equals(returnType.getQualifiedSourceName());
// Note that void is also a primitive type
boolean hasPrimitiveReturnType = hasReturnType
@@ -905,9 +906,9 @@ public class ConnectorBundleLoaderFactory extends Generator {
if (hasPrimitiveReturnType) {
// Integer.valueOf(expression);
- w.print("@%s::valueOf(%s)(", returnType.isPrimitive()
- .getQualifiedBoxedSourceName(), returnType
- .getJNISignature());
+ w.print("@%s::valueOf(%s)(",
+ returnType.isPrimitive().getQualifiedBoxedSourceName(),
+ returnType.getJNISignature());
// Implementation tested briefly, but I don't dare leave it
// enabled since we are not using it in the framework and we
@@ -923,8 +924,8 @@ public class ConnectorBundleLoaderFactory extends Generator {
JType[] parameterTypes = method.getParameterTypes();
- w.print("target.@%s::" + method.getName() + "(*)(", method
- .getEnclosingType().getQualifiedSourceName());
+ w.print("target.@%s::" + method.getName() + "(*)(",
+ method.getEnclosingType().getQualifiedSourceName());
for (int i = 0; i < parameterTypes.length; i++) {
if (i != 0) {
w.print(", ");
@@ -968,8 +969,8 @@ public class ConnectorBundleLoaderFactory extends Generator {
w.indent();
JType returnType = method.getReturnType();
- boolean hasReturnType = !"void".equals(returnType
- .getQualifiedSourceName());
+ boolean hasReturnType = !"void"
+ .equals(returnType.getQualifiedSourceName());
if (hasReturnType) {
w.print("return ");
}
@@ -989,8 +990,8 @@ public class ConnectorBundleLoaderFactory extends Generator {
// Need to pass through native method to allow casting Object to
// JSO if the value is a string
w.print("%s.<%s>obj2jso(params[%d])",
- JsonDecoder.class.getCanonicalName(),
- parameterTypeName, i);
+ JsonDecoder.class.getCanonicalName(), parameterTypeName,
+ i);
} else {
w.print("(" + parameterTypeName + ") params[" + i + "]");
}
@@ -1088,8 +1089,8 @@ public class ConnectorBundleLoaderFactory extends Generator {
}
private List<ConnectorBundle> buildBundles(TreeLogger logger,
- TypeOracle typeOracle) throws NotFoundException,
- UnableToCompleteException {
+ TypeOracle typeOracle)
+ throws NotFoundException, UnableToCompleteException {
Map<LoadStyle, Collection<JClassType>> connectorsByLoadStyle = new HashMap<LoadStyle, Collection<JClassType>>();
for (LoadStyle loadStyle : LoadStyle.values()) {
@@ -1097,8 +1098,8 @@ public class ConnectorBundleLoaderFactory extends Generator {
}
// Find all types with a valid mapping
- Collection<JClassType> selectedTypes = getConnectorsForWidgetset(
- logger, typeOracle);
+ Collection<JClassType> selectedTypes = getConnectorsForWidgetset(logger,
+ typeOracle);
// Group by load style
for (JClassType connectorSubtype : selectedTypes) {
@@ -1142,8 +1143,8 @@ public class ConnectorBundleLoaderFactory extends Generator {
for (JClassType type : lazy) {
ConnectorBundle bundle = new ConnectorBundle(type.getName(),
eagerBundle);
- TreeLogger subLogger = logger.branch(Type.TRACE, "Populating "
- + type.getName() + " bundle");
+ TreeLogger subLogger = logger.branch(Type.TRACE,
+ "Populating " + type.getName() + " bundle");
bundle.processType(subLogger, type);
bundles.add(bundle);
@@ -1176,8 +1177,8 @@ public class ConnectorBundleLoaderFactory extends Generator {
throws UnableToCompleteException {
JClassType serverConnectorType;
try {
- serverConnectorType = typeOracle.getType(ServerConnector.class
- .getName());
+ serverConnectorType = typeOracle
+ .getType(ServerConnector.class.getName());
} catch (NotFoundException e) {
logger.log(Type.ERROR,
"Can't find " + ServerConnector.class.getName());
@@ -1213,13 +1214,10 @@ public class ConnectorBundleLoaderFactory extends Generator {
superclass = type;
} else {
// Neither inherits from the other - this is a conflict
- logger.log(
- Type.ERROR,
+ logger.log(Type.ERROR,
"Conflicting @Connect mappings detected for "
- + identifier
- + ": "
- + type.getQualifiedSourceName()
- + " and "
+ + identifier + ": "
+ + type.getQualifiedSourceName() + " and "
+ previousMapping.getQualifiedSourceName()
+ ". There can only be multiple @Connect mappings for the same server-side type if one is the subclass of the other.");
throw new UnableToCompleteException();
diff --git a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/ClientRpcVisitor.java b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/ClientRpcVisitor.java
index 992a012005..044120467e 100644
--- a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/ClientRpcVisitor.java
+++ b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/ClientRpcVisitor.java
@@ -68,16 +68,11 @@ public class ClientRpcVisitor extends TypeVisitor {
public static void checkReturnType(TreeLogger logger, JMethod method)
throws UnableToCompleteException {
if (!method.getReturnType().getQualifiedSourceName().equals("void")) {
- logger.log(
- Type.ERROR,
- "The method "
- + method.getEnclosingType()
- .getQualifiedSourceName()
- + "."
- + method.getName()
- + " returns "
- + method.getReturnType().getQualifiedSourceName()
- + " but only void is supported for methods in RPC interfaces.");
+ logger.log(Type.ERROR, "The method "
+ + method.getEnclosingType().getQualifiedSourceName() + "."
+ + method.getName() + " returns "
+ + method.getReturnType().getQualifiedSourceName()
+ + " but only void is supported for methods in RPC interfaces.");
throw new UnableToCompleteException();
}
}
diff --git a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java
index b4531eb08e..d390ee0338 100644
--- a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java
+++ b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java
@@ -60,16 +60,16 @@ public class ConnectorBundle {
public static final Comparator<JClassType> jClassComparator = new Comparator<JClassType>() {
@Override
public int compare(JClassType o1, JClassType o2) {
- return o1.getQualifiedSourceName().compareTo(
- o2.getQualifiedSourceName());
+ return o1.getQualifiedSourceName()
+ .compareTo(o2.getQualifiedSourceName());
}
};
public static final Comparator<JMethod> jMethodComparator = new Comparator<JMethod>() {
@Override
public int compare(JMethod o1, JMethod o2) {
- return o1.getReadableDeclaration().compareTo(
- o2.getReadableDeclaration());
+ return o1.getReadableDeclaration()
+ .compareTo(o2.getReadableDeclaration());
}
};
@@ -140,10 +140,11 @@ public class ConnectorBundle {
TypeOracle oracle) throws NotFoundException {
Map<JType, JClassType> serializers = new HashMap<JType, JClassType>();
- JClassType serializerInterface = oracle.findType(JSONSerializer.class
- .getName());
+ JClassType serializerInterface = oracle
+ .findType(JSONSerializer.class.getName());
JType[] deserializeParamTypes = new JType[] {
- oracle.findType(com.vaadin.client.metadata.Type.class.getName()),
+ oracle.findType(
+ com.vaadin.client.metadata.Type.class.getName()),
oracle.findType(JsonValue.class.getName()),
oracle.findType(ApplicationConnection.class.getName()) };
String deserializeMethodName = "deserialize";
@@ -152,8 +153,8 @@ public class ConnectorBundle {
deserializeParamTypes);
for (JClassType serializer : serializerInterface.getSubtypes()) {
- JMethod deserializeMethod = serializer.findMethod(
- deserializeMethodName, deserializeParamTypes);
+ JMethod deserializeMethod = serializer
+ .findMethod(deserializeMethodName, deserializeParamTypes);
if (deserializeMethod == null) {
continue;
}
@@ -309,21 +310,18 @@ public class ConnectorBundle {
private void checkSerializable(TreeLogger logger, JClassType type)
throws UnableToCompleteException {
- JClassType javaSerializable = type.getOracle().findType(
- Serializable.class.getName());
+ JClassType javaSerializable = type.getOracle()
+ .findType(Serializable.class.getName());
boolean serializable = type.isAssignableTo(javaSerializable);
if (!serializable) {
- boolean abortCompile = "true".equals(System
- .getProperty(FAIL_IF_NOT_SERIALIZABLE));
- logger.log(
- abortCompile ? Type.ERROR : Type.WARN,
- type
- + " is used in RPC or shared state but does not implement "
- + Serializable.class.getName()
- + ". Communication will work but the Application on server side cannot be serialized if it refers to objects of this type. "
- + "If the system property "
- + FAIL_IF_NOT_SERIALIZABLE
- + " is set to \"true\", this causes the compilation to fail instead of just emitting a warning.");
+ boolean abortCompile = "true"
+ .equals(System.getProperty(FAIL_IF_NOT_SERIALIZABLE));
+ logger.log(abortCompile ? Type.ERROR : Type.WARN, type
+ + " is used in RPC or shared state but does not implement "
+ + Serializable.class.getName()
+ + ". Communication will work but the Application on server side cannot be serialized if it refers to objects of this type. "
+ + "If the system property " + FAIL_IF_NOT_SERIALIZABLE
+ + " is set to \"true\", this causes the compilation to fail instead of just emitting a warning.");
if (abortCompile) {
throw new UnableToCompleteException();
}
@@ -509,7 +507,8 @@ public class ConnectorBundle {
set.add(value);
}
- private <K> void addMapping(Map<K, Set<JMethod>> map, K key, JMethod value) {
+ private <K> void addMapping(Map<K, Set<JMethod>> map, K key,
+ JMethod value) {
Set<JMethod> set = map.get(key);
if (set == null) {
set = new TreeSet<JMethod>(jMethodComparator);
@@ -609,9 +608,8 @@ public class ConnectorBundle {
if (typeData != null && hasMapping(typeData, method, methodAttribute)) {
return true;
} else {
- return previousBundle != null
- && previousBundle.hasMethodAttribute(type, method,
- methodAttribute);
+ return previousBundle != null && previousBundle
+ .hasMethodAttribute(type, method, methodAttribute);
}
}
@@ -699,7 +697,8 @@ public class ConnectorBundle {
}
}
- private boolean isNeedsOnStateChangeHandler(JClassType type, JMethod method) {
+ private boolean isNeedsOnStateChangeHandler(JClassType type,
+ JMethod method) {
if (hasMapping(needsOnStateChange, type, method)) {
return true;
} else {
diff --git a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/FieldProperty.java b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/FieldProperty.java
index a31dafe05c..b04fe030e7 100644
--- a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/FieldProperty.java
+++ b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/FieldProperty.java
@@ -45,15 +45,16 @@ public class FieldProperty extends Property {
@Override
public void writeSetterBody(TreeLogger logger, SourceWriter w,
String beanVariable, String valueVariable) {
- w.println("%s.@%s::%s = %s;", beanVariable, getBeanType()
- .getQualifiedSourceName(), getName(), unboxValue(valueVariable));
+ w.println("%s.@%s::%s = %s;", beanVariable,
+ getBeanType().getQualifiedSourceName(), getName(),
+ unboxValue(valueVariable));
}
@Override
public void writeGetterBody(TreeLogger logger, SourceWriter w,
String beanVariable) {
- String value = String.format("%s.@%s::%s", beanVariable, getBeanType()
- .getQualifiedSourceName(), getName());
+ String value = String.format("%s.@%s::%s", beanVariable,
+ getBeanType().getQualifiedSourceName(), getName());
w.print("return ");
w.print(boxValue(value));
w.println(";");
diff --git a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/JsonSerializer.java b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/JsonSerializer.java
index a7a6c568da..253f180138 100644
--- a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/JsonSerializer.java
+++ b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/JsonSerializer.java
@@ -56,8 +56,8 @@ public abstract class JsonSerializer implements GeneratedSerializer {
+ ApplicationConnection.class.getName() + " connection) {");
w.indent();
// MouseEventDetails castedValue = (MouseEventDetails) value;
- w.println(qualifiedSourceName + " castedValue = ("
- + qualifiedSourceName + ") value;");
+ w.println(qualifiedSourceName + " castedValue = (" + qualifiedSourceName
+ + ") value;");
printSerializerBody(logger, w, "castedValue", "connection");
diff --git a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/MethodProperty.java b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/MethodProperty.java
index 32aad92774..e1c1b4e930 100644
--- a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/MethodProperty.java
+++ b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/MethodProperty.java
@@ -36,8 +36,8 @@ public class MethodProperty extends Property {
private final String getter;
private MethodProperty(JClassType beanType, JMethod setter, String getter) {
- super(getTransportFieldName(setter), beanType, setter
- .getParameterTypes()[0]);
+ super(getTransportFieldName(setter), beanType,
+ setter.getParameterTypes()[0]);
this.setter = setter;
this.getter = getter;
}
@@ -54,8 +54,8 @@ public class MethodProperty extends Property {
List<JMethod> setters = getSetters(type, getters);
for (JMethod setter : setters) {
String getter = findGetter(type, setter);
- properties.add(new MethodProperty(setter.getEnclosingType(),
- setter, getters.contains(getter) ? getter : null));
+ properties.add(new MethodProperty(setter.getEnclosingType(), setter,
+ getters.contains(getter) ? getter : null));
}
return properties;
@@ -74,9 +74,8 @@ public class MethodProperty extends Property {
Set<String> getters) {
List<JMethod> setterMethods = new ArrayList<JMethod>();
- while (beanType != null
- && !beanType.getQualifiedSourceName().equals(
- Object.class.getName())) {
+ while (beanType != null && !beanType.getQualifiedSourceName()
+ .equals(Object.class.getName())) {
for (JMethod method : beanType.getMethods()) {
// Process all setters that have corresponding fields
if (!method.isPublic() || method.isStatic()) {
@@ -112,18 +111,19 @@ public class MethodProperty extends Property {
@Override
public void writeSetterBody(TreeLogger logger, SourceWriter w,
String beanVariable, String valueVariable) {
- w.println("%s.@%s::%s(%s)(%s);", beanVariable, getBeanType()
- .getQualifiedSourceName(), setter.getName(), setter
- .getParameterTypes()[0].getJNISignature(),
+ w.println("%s.@%s::%s(%s)(%s);", beanVariable,
+ getBeanType().getQualifiedSourceName(), setter.getName(),
+ setter.getParameterTypes()[0].getJNISignature(),
unboxValue(valueVariable));
}
- private static String findGetter(JClassType beanType, JMethod setterMethod) {
+ private static String findGetter(JClassType beanType,
+ JMethod setterMethod) {
JType setterParameterType = setterMethod.getParameterTypes()[0];
String fieldName = setterMethod.getName().substring(3);
- if (setterParameterType.getQualifiedSourceName().equals(
- boolean.class.getName())) {
+ if (setterParameterType.getQualifiedSourceName()
+ .equals(boolean.class.getName())) {
return "is" + fieldName;
} else {
return "get" + fieldName;
diff --git a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/Property.java b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/Property.java
index 0c849bead5..7ed2826556 100644
--- a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/Property.java
+++ b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/Property.java
@@ -103,20 +103,20 @@ public abstract class Property implements Comparable<Property> {
@Override
public int hashCode() {
- return getClass().hashCode() * 31 ^ 2 + getBeanType().hashCode() * 31
- + getName().hashCode();
+ return getClass().hashCode() * 31
+ ^ 2 + getBeanType().hashCode() * 31 + getName().hashCode();
}
@Override
public int compareTo(Property o) {
int comp = getName().compareTo(o.getName());
if (comp == 0) {
- comp = getBeanType().getQualifiedSourceName().compareTo(
- o.getBeanType().getQualifiedSourceName());
+ comp = getBeanType().getQualifiedSourceName()
+ .compareTo(o.getBeanType().getQualifiedSourceName());
}
if (comp == 0) {
- comp = getClass().getCanonicalName().compareTo(
- o.getClass().getCanonicalName());
+ comp = getClass().getCanonicalName()
+ .compareTo(o.getClass().getCanonicalName());
}
return comp;
}
diff --git a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/RendererVisitor.java b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/RendererVisitor.java
index 8b645aa492..c1b3a6e7e4 100644
--- a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/RendererVisitor.java
+++ b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/RendererVisitor.java
@@ -57,17 +57,17 @@ public class RendererVisitor extends TypeVisitor {
private static void doRendererType(TreeLogger logger, JClassType type,
ConnectorBundle bundle) throws UnableToCompleteException {
// The class in which createRenderer is implemented
- JClassType createRendererClass = ConnectorBundle.findInheritedMethod(
- type, "createRenderer").getEnclosingType();
+ JClassType createRendererClass = ConnectorBundle
+ .findInheritedMethod(type, "createRenderer").getEnclosingType();
// Needs GWT constructor if createRenderer is not overridden
- if (createRendererClass.getQualifiedSourceName().equals(
- AbstractRendererConnector.class.getCanonicalName())) {
+ if (createRendererClass.getQualifiedSourceName()
+ .equals(AbstractRendererConnector.class.getCanonicalName())) {
JMethod getRenderer = ConnectorBundle.findInheritedMethod(type,
"getRenderer");
- if (getRenderer.getEnclosingType().getQualifiedSourceName()
- .equals(AbstractRendererConnector.class.getCanonicalName())) {
+ if (getRenderer.getEnclosingType().getQualifiedSourceName().equals(
+ AbstractRendererConnector.class.getCanonicalName())) {
logger.log(Type.ERROR, type.getQualifiedSourceName()
+ " must override either createRenderer or getRenderer");
throw new UnableToCompleteException();
@@ -79,8 +79,8 @@ public class RendererVisitor extends TypeVisitor {
// Also needs renderer type to find the right GWT constructor
bundle.setNeedsReturnType(type, getRenderer);
- logger.log(Type.DEBUG, "Renderer type of " + type + " is "
- + rendererType);
+ logger.log(Type.DEBUG,
+ "Renderer type of " + type + " is " + rendererType);
}
}
@@ -93,8 +93,8 @@ public class RendererVisitor extends TypeVisitor {
bundle.setNeedsSerialize(presentationType);
}
- logger.log(Type.DEBUG, "Presentation type of " + type + " is "
- + presentationType);
+ logger.log(Type.DEBUG,
+ "Presentation type of " + type + " is " + presentationType);
}
private static boolean hasCustomDecodeMethod(JClassType type,
@@ -110,8 +110,8 @@ public class RendererVisitor extends TypeVisitor {
return !decodeMethod.getEnclosingType().getQualifiedSourceName()
.equals(AbstractRendererConnector.class.getName());
} catch (NotFoundException e) {
- logger.log(Type.ERROR, "Can't find decode method for renderer "
- + type, e);
+ logger.log(Type.ERROR,
+ "Can't find decode method for renderer " + type, e);
throw new UnableToCompleteException();
}
}
@@ -120,16 +120,13 @@ public class RendererVisitor extends TypeVisitor {
throws UnableToCompleteException {
JClassType originalType = type;
while (type != null) {
- if (type.getQualifiedBinaryName().equals(
- AbstractRendererConnector.class.getName())) {
+ if (type.getQualifiedBinaryName()
+ .equals(AbstractRendererConnector.class.getName())) {
JParameterizedType parameterized = type.isParameterized();
if (parameterized == null) {
- logger.log(
- Type.ERROR,
- type.getQualifiedSourceName()
- + " must define the generic parameter of the inherited "
- + AbstractRendererConnector.class
- .getSimpleName());
+ logger.log(Type.ERROR, type.getQualifiedSourceName()
+ + " must define the generic parameter of the inherited "
+ + AbstractRendererConnector.class.getSimpleName());
throw new UnableToCompleteException();
}
return parameterized.getTypeArgs()[0];
diff --git a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/ServerRpcVisitor.java b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/ServerRpcVisitor.java
index 86ece28041..0bc6a3f479 100644
--- a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/ServerRpcVisitor.java
+++ b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/ServerRpcVisitor.java
@@ -52,7 +52,8 @@ public class ServerRpcVisitor extends TypeVisitor {
}
}
- if (method.getAnnotation(NoLoadingIndicator.class) != null) {
+ if (method
+ .getAnnotation(NoLoadingIndicator.class) != null) {
bundle.setMethodAttribute(type, method,
MethodAttribute.NO_LOADING_INDICATOR);
}
diff --git a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/StateInitVisitor.java b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/StateInitVisitor.java
index 046c5c4611..4175760df7 100644
--- a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/StateInitVisitor.java
+++ b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/StateInitVisitor.java
@@ -24,8 +24,8 @@ public class StateInitVisitor extends TypeVisitor {
@Override
public void visitConnector(TreeLogger logger, JClassType type,
ConnectorBundle bundle) {
- JMethod getState = ConnectorBundle
- .findInheritedMethod(type, "getState");
+ JMethod getState = ConnectorBundle.findInheritedMethod(type,
+ "getState");
bundle.setNeedsReturnType(type, getState);
bundle.setNeedsSerialize(getState.getReturnType());
diff --git a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/WidgetInitVisitor.java b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/WidgetInitVisitor.java
index 9a9cac18ba..5c1dc966af 100644
--- a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/WidgetInitVisitor.java
+++ b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/WidgetInitVisitor.java
@@ -32,8 +32,9 @@ public class WidgetInitVisitor extends TypeVisitor {
ConnectorBundle bundle) throws UnableToCompleteException {
if (ConnectorBundle.isConnectedComponentConnector(type)) {
// The class in which createWidget is implemented
- JClassType createWidgetClass = ConnectorBundle.findInheritedMethod(
- type, "createWidget").getEnclosingType();
+ JClassType createWidgetClass = ConnectorBundle
+ .findInheritedMethod(type, "createWidget")
+ .getEnclosingType();
JMethod getWidget = ConnectorBundle.findInheritedMethod(type,
"getWidget");
@@ -42,9 +43,7 @@ public class WidgetInitVisitor extends TypeVisitor {
// Needs GWT constructor if createWidget is not overridden
if (createWidgetClass.getQualifiedSourceName().equals(
AbstractComponentConnector.class.getCanonicalName())) {
- if (getWidget
- .getEnclosingType()
- .getQualifiedSourceName()
+ if (getWidget.getEnclosingType().getQualifiedSourceName()
.equals(AbstractComponentConnector.class
.getCanonicalName())) {
logger.log(Type.ERROR, type.getQualifiedSourceName()
@@ -79,12 +78,8 @@ public class WidgetInitVisitor extends TypeVisitor {
.findInheritedMethod(widgetType, methodName,
property.getPropertyType());
if (delegatedSetter == null) {
- logger.log(
- Type.ERROR,
- widgetType.getName()
- + "."
- + methodName
- + "("
+ logger.log(Type.ERROR,
+ widgetType.getName() + "." + methodName + "("
+ property.getPropertyType()
.getSimpleSourceName()
+ ") required by @DelegateToWidget for "
diff --git a/client-compiler/src/main/java/com/vaadin/tools/CvalAddonsChecker.java b/client-compiler/src/main/java/com/vaadin/tools/CvalAddonsChecker.java
index aab7231258..29bab5d5e4 100644
--- a/client-compiler/src/main/java/com/vaadin/tools/CvalAddonsChecker.java
+++ b/client-compiler/src/main/java/com/vaadin/tools/CvalAddonsChecker.java
@@ -108,14 +108,14 @@ public final class CvalAddonsChecker {
Attributes attribs = manifest.getMainAttributes();
String license = attribs.getValue(VAADIN_ADDON_LICENSE);
String name = attribs.getValue(VAADIN_ADDON_NAME);
- String vers = attribs.getValue(VAADIN_ADDON_VERSION) == null ? ""
- : attribs.getValue(VAADIN_ADDON_VERSION);
- String title = attribs.getValue(VAADIN_ADDON_TITLE) == null ? name
- : attribs.getValue(VAADIN_ADDON_TITLE);
+ String vers = attribs.getValue(VAADIN_ADDON_VERSION) == null
+ ? "" : attribs.getValue(VAADIN_ADDON_VERSION);
+ String title = attribs.getValue(VAADIN_ADDON_TITLE) == null
+ ? name : attribs.getValue(VAADIN_ADDON_TITLE);
String widgetsets = attribs
.getValue(VAADIN_ADDON_WIDGETSET) == null ? name
- : attribs.getValue(VAADIN_ADDON_WIDGETSET);
+ : attribs.getValue(VAADIN_ADDON_WIDGETSET);
if (name == null || license == null) {
continue;
@@ -131,14 +131,14 @@ public final class CvalAddonsChecker {
title);
printValidLicense(info, title, vers);
} catch (UnreachableCvalServerException e) {
- info = CvalChecker.parseJson("{'product':{'name':'"
- + name + "'}}");
+ info = CvalChecker.parseJson(
+ "{'product':{'name':'" + name + "'}}");
printServerUnreachable(title, vers);
}
for (String w : widgetsets.split("[, ]+")) {
- ret.add(new CValUiInfo(title, String
- .valueOf(computeMajorVersion(vers)), w,
- info.getType()));
+ ret.add(new CValUiInfo(title,
+ String.valueOf(computeMajorVersion(vers)),
+ w, info.getType()));
}
}
} catch (IOException ignored) {
@@ -174,13 +174,12 @@ public final class CvalAddonsChecker {
}
private void printServerUnreachable(String name, String version) {
- System.out.println(LINE
- + "\n"
- + getErrorMessage("unreachable", name,
- computeMajorVersion(version)) + "\n" + LINE);
+ System.out.println(LINE + "\n" + getErrorMessage("unreachable", name,
+ computeMajorVersion(version)) + "\n" + LINE);
}
- private void printValidLicense(CvalInfo info, String title, String version) {
+ private void printValidLicense(CvalInfo info, String title,
+ String version) {
String msg = info.getMessage();
if (msg == null) {
String key = "evaluation".equals(info.getType()) ? "evaluation"
diff --git a/client-compiler/src/main/java/com/vaadin/tools/CvalChecker.java b/client-compiler/src/main/java/com/vaadin/tools/CvalChecker.java
index 9217781695..950c0db6b0 100644
--- a/client-compiler/src/main/java/com/vaadin/tools/CvalChecker.java
+++ b/client-compiler/src/main/java/com/vaadin/tools/CvalChecker.java
@@ -153,8 +153,8 @@ public final class CvalChecker {
public boolean isLicenseExpired() {
return (getExpired() != null && getExpired())
- || (getExpiredEpoch() != null && getExpiredEpoch().before(
- new Date()));
+ || (getExpiredEpoch() != null
+ && getExpiredEpoch().before(new Date()));
}
public boolean isValidVersion(int majorVersion) {
@@ -248,8 +248,8 @@ public final class CvalChecker {
} else if (info != null && info.getMessage() != null) {
msg = info.getMessage().replace("\\n", "\n");
} else if (info != null && info.isLicenseExpired()) {
- String type = "evaluation".equals(info.getType()) ? "Evaluation license"
- : "License";
+ String type = "evaluation".equals(info.getType())
+ ? "Evaluation license" : "License";
msg = getErrorMessage("expired", title, majorVers, type);
} else if (key == null) {
msg = getErrorMessage("none", title, majorVers);
@@ -359,8 +359,8 @@ public final class CvalChecker {
* when we have license key but server is unreachable
*/
public CvalInfo validateProduct(String productName, String productVersion,
- String productTitle) throws InvalidCvalException,
- UnreachableCvalServerException {
+ String productTitle)
+ throws InvalidCvalException, UnreachableCvalServerException {
String key = getDeveloperLicenseKey(productName, productVersion,
productTitle);
@@ -416,8 +416,8 @@ public final class CvalChecker {
int timeout = validCache ? 2000 : 10000;
try {
- CvalInfo srvinfo = parseJson(provider.askServer(productName + "-"
- + productVersion, productKey, timeout));
+ CvalInfo srvinfo = parseJson(provider.askServer(
+ productName + "-" + productVersion, productKey, timeout));
if (srvinfo != null && srvinfo.isValidInfo(productName, productKey)
&& srvinfo.isValidVersion(majorVersion)) {
// We always cache the info if it is valid although it is
@@ -502,8 +502,8 @@ public final class CvalChecker {
static String getErrorMessage(String key, Object... pars) {
Locale loc = Locale.getDefault();
- ResourceBundle res = ResourceBundle.getBundle(
- CvalChecker.class.getName(), loc);
+ ResourceBundle res = ResourceBundle
+ .getBundle(CvalChecker.class.getName(), loc);
String msg = res.getString(key);
return new MessageFormat(msg, loc).format(pars);
}
diff --git a/client-compiler/src/main/java/com/vaadin/tools/WidgetsetCompiler.java b/client-compiler/src/main/java/com/vaadin/tools/WidgetsetCompiler.java
index 7c06e9d7af..65aa019b78 100755
--- a/client-compiler/src/main/java/com/vaadin/tools/WidgetsetCompiler.java
+++ b/client-compiler/src/main/java/com/vaadin/tools/WidgetsetCompiler.java
@@ -71,8 +71,8 @@ public class WidgetsetCompiler {
// TODO expecting this is launched via eclipse WTP
// project
- System.out
- .println("Updating GWT module description file...");
+ System.out.println(
+ "Updating GWT module description file...");
WidgetSetBuilder.updateWidgetSet(wsname);
System.out.println("Done.");
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();
}