summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorLeif Åstrand <legioth@gmail.com>2017-02-01 11:09:04 +0200
committerIlia Motornyi <elmot@vaadin.com>2017-02-01 11:09:04 +0200
commit07d56a9ca050d976dec4f598ed39471ae369c588 (patch)
tree167982734c11fa76b39cfad226b8f601174da17a /server
parent601de7e3ba5af6146ab0342bf3a924c9aa08a1b4 (diff)
downloadvaadin-framework-07d56a9ca050d976dec4f598ed39471ae369c588.tar.gz
vaadin-framework-07d56a9ca050d976dec4f598ed39471ae369c588.zip
Add a maven plugin for formatting according to Eclipse settings
Running formatter:format will format all files in a submodule using an embedded Eclipse compiler (based on Neon SR1) according to the regular formatting settings file.
Diffstat (limited to 'server')
-rw-r--r--server/src/main/java/com/vaadin/data/provider/QuerySortOrderBuilder.java5
-rw-r--r--server/src/main/java/com/vaadin/ui/AbstractDateField.java21
-rw-r--r--server/src/main/java/com/vaadin/ui/UI.java10
-rw-r--r--server/src/test/java/com/vaadin/data/GridAsMultiSelectInBinderTest.java6
-rw-r--r--server/src/test/java/com/vaadin/data/provider/DataProviderTestBase.java5
-rw-r--r--server/src/test/java/com/vaadin/server/VaadinSessionTest.java8
-rw-r--r--server/src/test/java/com/vaadin/tests/components/grid/GridNullValueSort.java56
-rw-r--r--server/src/test/java/com/vaadin/tests/design/ComponentFactoryTest.java9
-rw-r--r--server/src/test/java/com/vaadin/ui/AbstractSingleSelectTest.java11
-rw-r--r--server/src/test/java/com/vaadin/ui/DateTimeFieldConstructorTest.java18
-rw-r--r--server/src/test/java/com/vaadin/ui/PasswordFieldConstructorTest.java4
11 files changed, 66 insertions, 87 deletions
diff --git a/server/src/main/java/com/vaadin/data/provider/QuerySortOrderBuilder.java b/server/src/main/java/com/vaadin/data/provider/QuerySortOrderBuilder.java
index 1f8d1e1aab..eebe257973 100644
--- a/server/src/main/java/com/vaadin/data/provider/QuerySortOrderBuilder.java
+++ b/server/src/main/java/com/vaadin/data/provider/QuerySortOrderBuilder.java
@@ -21,13 +21,14 @@ import com.vaadin.shared.data.sort.SortDirection;
* Helper classes with fluent API for constructing {@link QuerySortOrder} lists.
* When the sort order is ready to be passed on, calling {@link #build()} will
* create the list of sort orders.
- *
+ *
* @see QuerySortOrder
* @see #thenDesc(String)
* @see #thenDesc(String)
* @see #build()
*/
-public class QuerySortOrderBuilder extends SortOrderBuilder<QuerySortOrder, String> {
+public class QuerySortOrderBuilder
+ extends SortOrderBuilder<QuerySortOrder, String> {
@Override
public QuerySortOrderBuilder thenAsc(String by) {
diff --git a/server/src/main/java/com/vaadin/ui/AbstractDateField.java b/server/src/main/java/com/vaadin/ui/AbstractDateField.java
index 57e0b0ce5f..06e6d74c30 100644
--- a/server/src/main/java/com/vaadin/ui/AbstractDateField.java
+++ b/server/src/main/java/com/vaadin/ui/AbstractDateField.java
@@ -62,12 +62,12 @@ import com.vaadin.ui.declarative.DesignContext;
* @author Vaadin Ltd
*
* @since 8.0
- *
+ *
* @param <T>
* type of date ({@code LocalDate} or {@code LocalDateTime}).
* @param <R>
* resolution enumeration type
- *
+ *
*/
public abstract class AbstractDateField<T extends Temporal & TemporalAdjuster & Serializable & Comparable<? super T>, R extends Enum<R>>
extends AbstractField<T>
@@ -121,7 +121,7 @@ public abstract class AbstractDateField<T extends Temporal & TemporalAdjuster &
/**
* Constructs an empty <code>AbstractDateField</code> with no caption and
* specified {@code resolution}.
- *
+ *
* @param resolution
* initial resolution for the field
*/
@@ -317,8 +317,9 @@ public abstract class AbstractDateField<T extends Temporal & TemporalAdjuster &
&& (newDate == null || !newDate.equals(oldDate))) {
setValue(newDate, true); // Don't require a repaint, client
// updates itself
- } else if (!uiHasValidDateString) { // oldDate ==
- // newDate == null
+ } else if (!uiHasValidDateString) {
+ // oldDate ==
+ // newDate == null
// Empty value set, previously contained unparsable date string,
// clear related internal fields
setValue(null);
@@ -693,7 +694,7 @@ public abstract class AbstractDateField<T extends Temporal & TemporalAdjuster &
/**
* Returns a date integer value part for the given {@code date} for the
* given {@code resolution}.
- *
+ *
* @param date
* the given date
* @param resolution
@@ -707,7 +708,7 @@ public abstract class AbstractDateField<T extends Temporal & TemporalAdjuster &
* keys are resolution and integer values.
* <p>
* This is the opposite to {@link #getDatePart(Temporal, Enum)}.
- *
+ *
* @param resolutionValues
* date values to construct a date
* @return date built from the given map of date values
@@ -717,14 +718,14 @@ public abstract class AbstractDateField<T extends Temporal & TemporalAdjuster &
/**
* Returns a custom date range validator which is applicable for the type
* {@code T}.
- *
+ *
* @return the date range validator
*/
protected abstract RangeValidator<T> getRangeValidator();
/**
* Converts {@link Date} to date type {@code T}.
- *
+ *
* @param date
* a date to convert
* @return object of type {@code T} representing the {@code date}
@@ -735,7 +736,7 @@ public abstract class AbstractDateField<T extends Temporal & TemporalAdjuster &
* Converts the object of type {@code T} to {@link Date}.
* <p>
* This is the opposite to {@link #convertFromDate(Date)}.
- *
+ *
* @param date
* the date of type {@code T}
* @return converted date of type {@code Date}
diff --git a/server/src/main/java/com/vaadin/ui/UI.java b/server/src/main/java/com/vaadin/ui/UI.java
index c0dabb37c0..00ccf2b0e2 100644
--- a/server/src/main/java/com/vaadin/ui/UI.java
+++ b/server/src/main/java/com/vaadin/ui/UI.java
@@ -194,11 +194,11 @@ public abstract class UI extends AbstractSingleComponentContainer
// Nothing to do, just need the message to be sent and processed
}
- @Override
- public void popstate(String uri) {
- getPage().updateLocation(uri, true, true);
-
- }
+ @Override
+ public void popstate(String uri) {
+ getPage().updateLocation(uri, true, true);
+
+ }
};
private DebugWindowServerRpc debugRpc = new DebugWindowServerRpc() {
@Override
diff --git a/server/src/test/java/com/vaadin/data/GridAsMultiSelectInBinderTest.java b/server/src/test/java/com/vaadin/data/GridAsMultiSelectInBinderTest.java
index 398af7c1b1..5cda28b639 100644
--- a/server/src/test/java/com/vaadin/data/GridAsMultiSelectInBinderTest.java
+++ b/server/src/test/java/com/vaadin/data/GridAsMultiSelectInBinderTest.java
@@ -233,10 +233,10 @@ public class GridAsMultiSelectInBinderTest
assertEquals(Arrays.asList(), selected);
selected.clear();
+ // client side deselect
model.updateSelection(Collections.emptySet(),
- new LinkedHashSet<>(Arrays.asList(Sex.UNKNOWN)), true); // client
- // side
- // deselect
+ new LinkedHashSet<>(Arrays.asList(Sex.UNKNOWN)), true);
+
assertEquals(Arrays.asList(Sex.MALE), selected);
selected.clear();
diff --git a/server/src/test/java/com/vaadin/data/provider/DataProviderTestBase.java b/server/src/test/java/com/vaadin/data/provider/DataProviderTestBase.java
index 84f011abf8..2fea57ae80 100644
--- a/server/src/test/java/com/vaadin/data/provider/DataProviderTestBase.java
+++ b/server/src/test/java/com/vaadin/data/provider/DataProviderTestBase.java
@@ -82,9 +82,8 @@ public abstract class DataProviderTestBase<D extends DataProvider<StrBean, Seria
.thenComparing(StrBean::getId);
List<StrBean> list = dataProvider
- .fetch(createQuery(
- QuerySortOrder.asc("value").thenAsc("randomNumber")
- .thenAsc("id").build(), comp))
+ .fetch(createQuery(QuerySortOrder.asc("value")
+ .thenAsc("randomNumber").thenAsc("id").build(), comp))
.collect(Collectors.toList());
// First value in data is { Xyz, 10, 100 } which should be last in list
diff --git a/server/src/test/java/com/vaadin/server/VaadinSessionTest.java b/server/src/test/java/com/vaadin/server/VaadinSessionTest.java
index 0a26bef1f6..5b5528e8e3 100644
--- a/server/src/test/java/com/vaadin/server/VaadinSessionTest.java
+++ b/server/src/test/java/com/vaadin/server/VaadinSessionTest.java
@@ -74,12 +74,10 @@ public class VaadinSessionTest implements Serializable {
Object res;
try {
Thread.sleep(100); // for deadlock testing
+
+ // simulates servlet container's session locking
org.junit.Assert.assertTrue("Deadlock detected",
- httpSessionLock.tryLock(5, TimeUnit.SECONDS)); // simulates
- // servlet
- // container's
- // session
- // locking
+ httpSessionLock.tryLock(5, TimeUnit.SECONDS));
String lockAttribute = mockService.getServiceName()
+ ".lock";
if (lockAttribute.equals(name)) {
diff --git a/server/src/test/java/com/vaadin/tests/components/grid/GridNullValueSort.java b/server/src/test/java/com/vaadin/tests/components/grid/GridNullValueSort.java
index 4a3a0315c5..57cc19fa1b 100644
--- a/server/src/test/java/com/vaadin/tests/components/grid/GridNullValueSort.java
+++ b/server/src/test/java/com/vaadin/tests/components/grid/GridNullValueSort.java
@@ -34,111 +34,95 @@ public class GridNullValueSort {
public void setup() {
VaadinSession.setCurrent(null);
grid = new TestGrid();
- grid.addColumn(i -> i, new NumberRenderer()).setId("int").setSortable(true);
- grid.addColumn(i -> i == null ? null : String.valueOf(i)).setId("String").setSortable(true);
- grid.addColumn(i -> i == null ? null : i != 1, booleanRenderer()).setId("Boolean").setSortable(true);
+ grid.addColumn(i -> i, new NumberRenderer()).setId("int")
+ .setSortable(true);
+ grid.addColumn(i -> i == null ? null : String.valueOf(i))
+ .setId("String").setSortable(true);
+ grid.addColumn(i -> i == null ? null : i != 1, booleanRenderer())
+ .setId("Boolean").setSortable(true);
}
@Test
public void testNumbersNotNulls() {
grid.sort(grid.getColumn("int"), SortDirection.ASCENDING);
- performSort(
- Arrays.asList(2, 1, 3),
- Arrays.asList(1, 2, 3));
+ performSort(Arrays.asList(2, 1, 3), Arrays.asList(1, 2, 3));
}
@Test
public void testNumbers() {
grid.sort(grid.getColumn("int"), SortDirection.ASCENDING);
- performSort(
- Arrays.asList(1, 2, null, 3, null, null),
+ performSort(Arrays.asList(1, 2, null, 3, null, null),
Arrays.asList(1, 2, 3, null, null, null));
}
@Test
public void testNumbersNotNullsDescending() {
grid.sort(grid.getColumn("int"), SortDirection.DESCENDING);
- performSort(
- Arrays.asList(1, 2, 3),
- Arrays.asList(3, 2, 1));
+ performSort(Arrays.asList(1, 2, 3), Arrays.asList(3, 2, 1));
}
@Test
public void testNumbersDescending() {
grid.sort(grid.getColumn("int"), SortDirection.DESCENDING);
- performSort(
- Arrays.asList(1, 3, null, null, null, 2),
+ performSort(Arrays.asList(1, 3, null, null, null, 2),
Arrays.asList(null, null, null, 3, 2, 1));
}
@Test
public void testStringsNotNulls() {
grid.sort(grid.getColumn("String"), SortDirection.ASCENDING);
- performSort(
- Arrays.asList(2, 1, 3),
- Arrays.asList(1, 2, 3));
+ performSort(Arrays.asList(2, 1, 3), Arrays.asList(1, 2, 3));
}
@Test
public void testStrings() {
grid.sort(grid.getColumn("String"), SortDirection.ASCENDING);
- performSort(
- Arrays.asList(1, 2, null, 3, null, null),
+ performSort(Arrays.asList(1, 2, null, 3, null, null),
Arrays.asList(1, 2, 3, null, null, null));
}
@Test
public void testStringsNotNullsDescending() {
grid.sort(grid.getColumn("String"), SortDirection.DESCENDING);
- performSort(
- Arrays.asList(1, 2, 3),
- Arrays.asList(3, 2, 1));
+ performSort(Arrays.asList(1, 2, 3), Arrays.asList(3, 2, 1));
}
@Test
public void testStringsDescending() {
grid.sort(grid.getColumn("String"), SortDirection.DESCENDING);
- performSort(
- Arrays.asList(1, 3, null, null, null, 2),
+ performSort(Arrays.asList(1, 3, null, null, null, 2),
Arrays.asList(null, null, null, 3, 2, 1));
}
-
@Test
public void testBooleansNotNulls() {
grid.sort(grid.getColumn("Boolean"), SortDirection.ASCENDING);
- performSort(
- Arrays.asList(2, 1),
- Arrays.asList(1, 2));
+ performSort(Arrays.asList(2, 1), Arrays.asList(1, 2));
}
@Test
public void testBooleans() {
grid.sort(grid.getColumn("Boolean"), SortDirection.ASCENDING);
- performSort(
- Arrays.asList(1, null, 2, null, null),
+ performSort(Arrays.asList(1, null, 2, null, null),
Arrays.asList(1, 2, null, null, null));
}
@Test
public void testBooleansNotNullsDescending() {
grid.sort(grid.getColumn("Boolean"), SortDirection.DESCENDING);
- performSort(
- Arrays.asList(1, 2),
- Arrays.asList(2, 1));
+ performSort(Arrays.asList(1, 2), Arrays.asList(2, 1));
}
@Test
public void testBooleansDescending() {
grid.sort(grid.getColumn("Boolean"), SortDirection.DESCENDING);
- performSort(
- Arrays.asList(1, null, null, null, 2),
+ performSort(Arrays.asList(1, null, null, null, 2),
Arrays.asList(null, null, null, 2, 1));
}
-
private void performSort(List<Integer> source, List<Integer> expected) {
- SerializableComparator<Integer> sortingComparator = grid.createSortingComparator();
+ SerializableComparator<Integer> sortingComparator = grid
+ .createSortingComparator();
List<Integer> data = new ArrayList<>(source);
data.sort(sortingComparator);
Assert.assertEquals(expected, data);
diff --git a/server/src/test/java/com/vaadin/tests/design/ComponentFactoryTest.java b/server/src/test/java/com/vaadin/tests/design/ComponentFactoryTest.java
index 98224d90c1..813ff361f3 100644
--- a/server/src/test/java/com/vaadin/tests/design/ComponentFactoryTest.java
+++ b/server/src/test/java/com/vaadin/tests/design/ComponentFactoryTest.java
@@ -88,14 +88,9 @@ public class ComponentFactoryTest {
public void testComponentFactoryThrowingStuff() {
currentComponentFactory.set((ComponentFactory) (
String fullyQualifiedClassName,
+ // Will throw because class is not found
DesignContext context) -> defaultFactory.createComponent(
- "foobar." + fullyQualifiedClassName, context) // Will
- // throw
- // because
- // class
- // is not
- // found
- );
+ "foobar." + fullyQualifiedClassName, context));
Design.read(new ByteArrayInputStream("<vaadin-label />".getBytes()));
}
diff --git a/server/src/test/java/com/vaadin/ui/AbstractSingleSelectTest.java b/server/src/test/java/com/vaadin/ui/AbstractSingleSelectTest.java
index fa419118ff..6097ab3af7 100644
--- a/server/src/test/java/com/vaadin/ui/AbstractSingleSelectTest.java
+++ b/server/src/test/java/com/vaadin/ui/AbstractSingleSelectTest.java
@@ -62,8 +62,7 @@ public class AbstractSingleSelectTest {
}
@Override
- protected void readItems(Element design,
- DesignContext context) {
+ protected void readItems(Element design, DesignContext context) {
}
@Override
@@ -265,8 +264,7 @@ public class AbstractSingleSelectTest {
}
@Override
- protected void readItems(Element design,
- DesignContext context) {
+ protected void readItems(Element design, DesignContext context) {
}
@Override
@@ -283,9 +281,8 @@ public class AbstractSingleSelectTest {
});
Assert.assertSame(registration, actualRegistration);
- selectionListener.get()
- .selectionChange(
- new SingleSelectionEvent<>(select, value, true));
+ selectionListener.get().selectionChange(
+ new SingleSelectionEvent<>(select, value, true));
Assert.assertEquals(select, event.get().getComponent());
Assert.assertEquals(value, event.get().getOldValue());
diff --git a/server/src/test/java/com/vaadin/ui/DateTimeFieldConstructorTest.java b/server/src/test/java/com/vaadin/ui/DateTimeFieldConstructorTest.java
index 21715f7782..90a452942e 100644
--- a/server/src/test/java/com/vaadin/ui/DateTimeFieldConstructorTest.java
+++ b/server/src/test/java/com/vaadin/ui/DateTimeFieldConstructorTest.java
@@ -32,14 +32,17 @@ public class DateTimeFieldConstructorTest {
public void initiallyEmpty() {
DateTimeField dateTimeField = new DateTimeField();
Assert.assertTrue(dateTimeField.isEmpty());
- Assert.assertEquals(DateTimeResolution.MINUTE, dateTimeField.getResolution());
+ Assert.assertEquals(DateTimeResolution.MINUTE,
+ dateTimeField.getResolution());
}
@Test
public void testValueConstructor_emptyAfterClear() {
- DateTimeField dateTimeField = new DateTimeField(null, LocalDateTime.now());
+ DateTimeField dateTimeField = new DateTimeField(null,
+ LocalDateTime.now());
Assert.assertFalse(dateTimeField.isEmpty());
- Assert.assertEquals(DateTimeResolution.MINUTE, dateTimeField.getResolution());
+ Assert.assertEquals(DateTimeResolution.MINUTE,
+ dateTimeField.getResolution());
dateTimeField.clear();
Assert.assertTrue(dateTimeField.isEmpty());
@@ -50,7 +53,8 @@ public class DateTimeFieldConstructorTest {
HasValue.ValueChangeListener valueChangeListener = Mockito
.mock(HasValue.ValueChangeListener.class);
DateTimeField dateTimeField = new DateTimeField(valueChangeListener);
- Assert.assertEquals(DateTimeResolution.MINUTE, dateTimeField.getResolution());
+ Assert.assertEquals(DateTimeResolution.MINUTE,
+ dateTimeField.getResolution());
dateTimeField.setValue(LocalDateTime.now());
@@ -64,9 +68,9 @@ public class DateTimeFieldConstructorTest {
HasValue.ValueChangeListener valueChangeListener = Mockito
.mock(HasValue.ValueChangeListener.class);
DateTimeField dateTimeField = new DateTimeField("Caption",
- LocalDateTime.now(),
- valueChangeListener);
- Assert.assertEquals(DateTimeResolution.MINUTE, dateTimeField.getResolution());
+ LocalDateTime.now(), valueChangeListener);
+ Assert.assertEquals(DateTimeResolution.MINUTE,
+ dateTimeField.getResolution());
verify(valueChangeListener, never())
.valueChange(Mockito.any(HasValue.ValueChangeEvent.class));
diff --git a/server/src/test/java/com/vaadin/ui/PasswordFieldConstructorTest.java b/server/src/test/java/com/vaadin/ui/PasswordFieldConstructorTest.java
index 61f31b0269..d6f8cc2a5c 100644
--- a/server/src/test/java/com/vaadin/ui/PasswordFieldConstructorTest.java
+++ b/server/src/test/java/com/vaadin/ui/PasswordFieldConstructorTest.java
@@ -57,8 +57,8 @@ public class PasswordFieldConstructorTest {
public void testCaptionValueListener() {
HasValue.ValueChangeListener valueChangeListener = Mockito
.mock(HasValue.ValueChangeListener.class);
- PasswordField passwordField = new PasswordField("Caption", "Initial value",
- valueChangeListener);
+ PasswordField passwordField = new PasswordField("Caption",
+ "Initial value", valueChangeListener);
verify(valueChangeListener, never())
.valueChange(Mockito.any(HasValue.ValueChangeEvent.class));