diff options
Diffstat (limited to 'server/tests/src')
88 files changed, 369 insertions, 112 deletions
diff --git a/server/tests/src/ClassInDefaultPackage.java b/server/tests/src/ClassInDefaultPackage.java index 1eb8bc4df5..52dc87e0e2 100644 --- a/server/tests/src/ClassInDefaultPackage.java +++ b/server/tests/src/ClassInDefaultPackage.java @@ -1,7 +1,7 @@ import org.junit.Ignore; /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/server/tests/src/com/vaadin/data/DefaultFieldGroupFieldFactoryTest.java b/server/tests/src/com/vaadin/data/DefaultFieldGroupFieldFactoryTest.java index b319c13e4e..a5fee5175e 100644 --- a/server/tests/src/com/vaadin/data/DefaultFieldGroupFieldFactoryTest.java +++ b/server/tests/src/com/vaadin/data/DefaultFieldGroupFieldFactoryTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of @@ -17,8 +17,7 @@ package com.vaadin.data; import java.util.Date; -import junit.framework.Assert; - +import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/server/tests/src/com/vaadin/data/fieldgroup/BeanFieldGroupTest.java b/server/tests/src/com/vaadin/data/fieldgroup/BeanFieldGroupTest.java index a01c2dea8f..3333cd7744 100644 --- a/server/tests/src/com/vaadin/data/fieldgroup/BeanFieldGroupTest.java +++ b/server/tests/src/com/vaadin/data/fieldgroup/BeanFieldGroupTest.java @@ -15,8 +15,7 @@ */ package com.vaadin.data.fieldgroup; -import junit.framework.Assert; - +import org.junit.Assert; import org.junit.Test; public class BeanFieldGroupTest { diff --git a/server/tests/src/com/vaadin/data/fieldgroup/FieldGroupDate.java b/server/tests/src/com/vaadin/data/fieldgroup/FieldGroupDate.java index e11b6e50f8..07e36b93f9 100644 --- a/server/tests/src/com/vaadin/data/fieldgroup/FieldGroupDate.java +++ b/server/tests/src/com/vaadin/data/fieldgroup/FieldGroupDate.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of @@ -17,8 +17,7 @@ package com.vaadin.data.fieldgroup; import java.util.Date; -import junit.framework.Assert; - +import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/server/tests/src/com/vaadin/data/util/AbstractContainerTest.java b/server/tests/src/com/vaadin/data/util/AbstractContainerTest.java index 81c90ba07b..a443499a89 100644 --- a/server/tests/src/com/vaadin/data/util/AbstractContainerTest.java +++ b/server/tests/src/com/vaadin/data/util/AbstractContainerTest.java @@ -3,9 +3,10 @@ package com.vaadin.data.util; import java.util.ArrayList; import java.util.List; -import junit.framework.Assert; import junit.framework.TestCase; +import org.junit.Assert; + import com.vaadin.data.Container; import com.vaadin.data.Container.Filterable; import com.vaadin.data.Container.ItemSetChangeEvent; diff --git a/server/tests/src/com/vaadin/data/util/BeanContainerTest.java b/server/tests/src/com/vaadin/data/util/BeanContainerTest.java index a6c3bb0b8b..4e0e98ec43 100644 --- a/server/tests/src/com/vaadin/data/util/BeanContainerTest.java +++ b/server/tests/src/com/vaadin/data/util/BeanContainerTest.java @@ -7,7 +7,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; -import junit.framework.Assert; +import org.junit.Assert; import com.vaadin.data.Container; import com.vaadin.data.Item; diff --git a/server/tests/src/com/vaadin/data/util/BeanItemContainerSortTest.java b/server/tests/src/com/vaadin/data/util/BeanItemContainerSortTest.java index 346e931f61..4f4e35258f 100644 --- a/server/tests/src/com/vaadin/data/util/BeanItemContainerSortTest.java +++ b/server/tests/src/com/vaadin/data/util/BeanItemContainerSortTest.java @@ -7,8 +7,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import junit.framework.Assert; - +import org.junit.Assert; import org.junit.Test; public class BeanItemContainerSortTest { diff --git a/server/tests/src/com/vaadin/data/util/BeanItemContainerTest.java b/server/tests/src/com/vaadin/data/util/BeanItemContainerTest.java index b9633753b4..463f0c92c1 100644 --- a/server/tests/src/com/vaadin/data/util/BeanItemContainerTest.java +++ b/server/tests/src/com/vaadin/data/util/BeanItemContainerTest.java @@ -8,7 +8,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import junit.framework.Assert; +import org.junit.Assert; import org.easymock.Capture; import org.easymock.EasyMock; diff --git a/server/tests/src/com/vaadin/data/util/BeanItemTest.java b/server/tests/src/com/vaadin/data/util/BeanItemTest.java index e1ad75796c..b458856826 100644 --- a/server/tests/src/com/vaadin/data/util/BeanItemTest.java +++ b/server/tests/src/com/vaadin/data/util/BeanItemTest.java @@ -9,9 +9,10 @@ import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; -import junit.framework.Assert; import junit.framework.TestCase; +import org.junit.Assert; + /** * Test BeanItem specific features. * diff --git a/server/tests/src/com/vaadin/data/util/MethodPropertyMemoryConsumption.java b/server/tests/src/com/vaadin/data/util/MethodPropertyMemoryConsumption.java index caff33cf50..ce0711a29e 100644 --- a/server/tests/src/com/vaadin/data/util/MethodPropertyMemoryConsumption.java +++ b/server/tests/src/com/vaadin/data/util/MethodPropertyMemoryConsumption.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/server/tests/src/com/vaadin/data/util/PerformanceTestIndexedContainer.java b/server/tests/src/com/vaadin/data/util/PerformanceTestIndexedContainer.java index 35335edd23..1c49017bf1 100644 --- a/server/tests/src/com/vaadin/data/util/PerformanceTestIndexedContainer.java +++ b/server/tests/src/com/vaadin/data/util/PerformanceTestIndexedContainer.java @@ -6,9 +6,10 @@ import java.util.Collections; import java.util.SortedSet; import java.util.TreeSet; -import junit.framework.Assert; import junit.framework.TestCase; +import org.junit.Assert; + public class PerformanceTestIndexedContainer extends TestCase { private static final int REPEATS = 10; diff --git a/server/tests/src/com/vaadin/data/util/PropertyDescriptorTest.java b/server/tests/src/com/vaadin/data/util/PropertyDescriptorTest.java index 12ded84fe2..68861536a9 100644 --- a/server/tests/src/com/vaadin/data/util/PropertyDescriptorTest.java +++ b/server/tests/src/com/vaadin/data/util/PropertyDescriptorTest.java @@ -7,9 +7,10 @@ import java.io.ByteArrayOutputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; -import junit.framework.Assert; import junit.framework.TestCase; +import org.junit.Assert; + import com.vaadin.data.Property; import com.vaadin.data.util.NestedMethodPropertyTest.Person; diff --git a/server/tests/src/com/vaadin/data/util/PropertySetItemTest.java b/server/tests/src/com/vaadin/data/util/PropertySetItemTest.java index a3169332ec..ff83db4437 100644 --- a/server/tests/src/com/vaadin/data/util/PropertySetItemTest.java +++ b/server/tests/src/com/vaadin/data/util/PropertySetItemTest.java @@ -2,10 +2,10 @@ package com.vaadin.data.util; import java.util.Iterator; -import junit.framework.Assert; import junit.framework.TestCase; import org.easymock.EasyMock; +import org.junit.Assert; import com.vaadin.data.Item.PropertySetChangeEvent; import com.vaadin.data.Item.PropertySetChangeListener; diff --git a/server/tests/src/com/vaadin/data/util/TestIndexedContainer.java b/server/tests/src/com/vaadin/data/util/TestIndexedContainer.java index 5c78965092..ddfee103c3 100644 --- a/server/tests/src/com/vaadin/data/util/TestIndexedContainer.java +++ b/server/tests/src/com/vaadin/data/util/TestIndexedContainer.java @@ -2,7 +2,7 @@ package com.vaadin.data.util; import java.util.List; -import junit.framework.Assert; +import org.junit.Assert; import org.easymock.Capture; import org.easymock.EasyMock; diff --git a/server/tests/src/com/vaadin/data/util/TransactionalPropertyWrapperTest.java b/server/tests/src/com/vaadin/data/util/TransactionalPropertyWrapperTest.java new file mode 100644 index 0000000000..5297cd807c --- /dev/null +++ b/server/tests/src/com/vaadin/data/util/TransactionalPropertyWrapperTest.java @@ -0,0 +1,116 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.data.util; + +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; + +import com.vaadin.data.fieldgroup.FieldGroup; +import com.vaadin.ui.TextField; + +/** + * Test verifying that TransactionalPropertyWrapper removes it's listener from + * wrapped Property + * + * @since 7.1.15 + * @author Vaadin Ltd + */ +public class TransactionalPropertyWrapperTest { + + @SuppressWarnings("serial") + public class TestingProperty<T extends Object> extends + ObjectProperty<Object> { + + private List<ValueChangeListener> listeners = new ArrayList<ValueChangeListener>(); + + public TestingProperty(Object value) { + super(value); + } + + @Override + public void addValueChangeListener(ValueChangeListener listener) { + super.addValueChangeListener(listener); + listeners.add(listener); + } + + @Override + public void removeValueChangeListener(ValueChangeListener listener) { + super.removeValueChangeListener(listener); + if (listeners.contains(listener)) { + listeners.remove(listener); + } + } + + public boolean hasListeners() { + return !listeners.isEmpty(); + } + } + + private final TextField nameField = new TextField("Name"); + private final TextField ageField = new TextField("Age"); + private final TextField unboundField = new TextField("No FieldGroup"); + private final TestingProperty<String> unboundProp = new TestingProperty<String>( + "Hello World"); + private final PropertysetItem item = new PropertysetItem(); + + @Test + public void fieldGroupBindAndUnbind() { + item.addItemProperty("name", new TestingProperty<String>( + "Just some text")); + item.addItemProperty("age", new TestingProperty<String>("42")); + + final FieldGroup binder = new FieldGroup(item); + binder.setBuffered(false); + + for (int i = 0; i < 2; ++i) { + binder.bind(nameField, "name"); + binder.bind(ageField, "age"); + unboundField.setPropertyDataSource(unboundProp); + + assertTrue("No listeners in Properties", fieldsHaveListeners(true)); + + binder.unbind(nameField); + binder.unbind(ageField); + unboundField.setPropertyDataSource(null); + + assertTrue("Listeners in Properties after unbinding", + fieldsHaveListeners(false)); + } + } + + /** + * Check that all listeners have same hasListeners() response + * + * @param expected + * expected response + * @return true if all are the same as expected. false if not + */ + private boolean fieldsHaveListeners(boolean expected) { + for (Object id : item.getItemPropertyIds()) { + TestingProperty<?> itemProperty = (TestingProperty<?>) item + .getItemProperty(id); + + if (itemProperty.hasListeners() != expected) { + return false; + } + } + return unboundProp.hasListeners() == expected; + } +} diff --git a/server/tests/src/com/vaadin/data/util/filter/AndOrFilterTest.java b/server/tests/src/com/vaadin/data/util/filter/AndOrFilterTest.java index fdd5b8a645..e5bc622e39 100644 --- a/server/tests/src/com/vaadin/data/util/filter/AndOrFilterTest.java +++ b/server/tests/src/com/vaadin/data/util/filter/AndOrFilterTest.java @@ -1,6 +1,6 @@ package com.vaadin.data.util.filter; -import junit.framework.Assert; +import org.junit.Assert; import com.vaadin.data.Container.Filter; import com.vaadin.data.Item; diff --git a/server/tests/src/com/vaadin/data/util/filter/CompareFilterTest.java b/server/tests/src/com/vaadin/data/util/filter/CompareFilterTest.java index b7ccd68429..732a541c89 100644 --- a/server/tests/src/com/vaadin/data/util/filter/CompareFilterTest.java +++ b/server/tests/src/com/vaadin/data/util/filter/CompareFilterTest.java @@ -3,7 +3,7 @@ package com.vaadin.data.util.filter; import java.math.BigDecimal; import java.util.Date; -import junit.framework.Assert; +import org.junit.Assert; import com.vaadin.data.Container.Filter; import com.vaadin.data.Item; diff --git a/server/tests/src/com/vaadin/data/util/filter/IsNullFilterTest.java b/server/tests/src/com/vaadin/data/util/filter/IsNullFilterTest.java index 6f90273de1..d3e959e069 100644 --- a/server/tests/src/com/vaadin/data/util/filter/IsNullFilterTest.java +++ b/server/tests/src/com/vaadin/data/util/filter/IsNullFilterTest.java @@ -1,6 +1,6 @@ package com.vaadin.data.util.filter; -import junit.framework.Assert; +import org.junit.Assert; import com.vaadin.data.Container.Filter; import com.vaadin.data.Item; diff --git a/server/tests/src/com/vaadin/data/util/filter/LikeFilterTest.java b/server/tests/src/com/vaadin/data/util/filter/LikeFilterTest.java index 15ad85e10d..0fcbd26b8e 100644 --- a/server/tests/src/com/vaadin/data/util/filter/LikeFilterTest.java +++ b/server/tests/src/com/vaadin/data/util/filter/LikeFilterTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of @@ -16,7 +16,7 @@ package com.vaadin.data.util.filter; -import junit.framework.Assert; +import org.junit.Assert; import com.vaadin.data.Item; import com.vaadin.data.util.ObjectProperty; diff --git a/server/tests/src/com/vaadin/data/util/filter/NotFilterTest.java b/server/tests/src/com/vaadin/data/util/filter/NotFilterTest.java index c3b666e6f7..966ffd3a6e 100644 --- a/server/tests/src/com/vaadin/data/util/filter/NotFilterTest.java +++ b/server/tests/src/com/vaadin/data/util/filter/NotFilterTest.java @@ -1,6 +1,6 @@ package com.vaadin.data.util.filter; -import junit.framework.Assert; +import org.junit.Assert; import com.vaadin.data.Container.Filter; import com.vaadin.data.Item; diff --git a/server/tests/src/com/vaadin/data/util/filter/SimpleStringFilterTest.java b/server/tests/src/com/vaadin/data/util/filter/SimpleStringFilterTest.java index bc63d57752..eb7dff6015 100644 --- a/server/tests/src/com/vaadin/data/util/filter/SimpleStringFilterTest.java +++ b/server/tests/src/com/vaadin/data/util/filter/SimpleStringFilterTest.java @@ -1,6 +1,6 @@ package com.vaadin.data.util.filter; -import junit.framework.Assert; +import org.junit.Assert; public class SimpleStringFilterTest extends AbstractFilterTest<SimpleStringFilter> { diff --git a/server/tests/src/com/vaadin/data/util/sqlcontainer/ReadOnlyRowIdTest.java b/server/tests/src/com/vaadin/data/util/sqlcontainer/ReadOnlyRowIdTest.java index 63716bb33b..248dc62d93 100644 --- a/server/tests/src/com/vaadin/data/util/sqlcontainer/ReadOnlyRowIdTest.java +++ b/server/tests/src/com/vaadin/data/util/sqlcontainer/ReadOnlyRowIdTest.java @@ -1,7 +1,6 @@ package com.vaadin.data.util.sqlcontainer; -import junit.framework.Assert; - +import org.junit.Assert; import org.junit.Test; public class ReadOnlyRowIdTest { diff --git a/server/tests/src/com/vaadin/data/util/sqlcontainer/SQLTestsConstants.java b/server/tests/src/com/vaadin/data/util/sqlcontainer/SQLTestsConstants.java index 1e96d59ed5..e03e970048 100755 --- a/server/tests/src/com/vaadin/data/util/sqlcontainer/SQLTestsConstants.java +++ b/server/tests/src/com/vaadin/data/util/sqlcontainer/SQLTestsConstants.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of @@ -151,4 +151,4 @@ public class SQLTestsConstants { } } -}
\ No newline at end of file +} diff --git a/server/tests/src/com/vaadin/data/util/sqlcontainer/UtilTest.java b/server/tests/src/com/vaadin/data/util/sqlcontainer/UtilTest.java index 0187f9068e..a575d649f1 100644 --- a/server/tests/src/com/vaadin/data/util/sqlcontainer/UtilTest.java +++ b/server/tests/src/com/vaadin/data/util/sqlcontainer/UtilTest.java @@ -1,7 +1,6 @@ package com.vaadin.data.util.sqlcontainer; -import junit.framework.Assert; - +import org.junit.Assert; import org.junit.Test; public class UtilTest { diff --git a/server/tests/src/com/vaadin/data/util/sqlcontainer/connection/J2EEConnectionPoolTest.java b/server/tests/src/com/vaadin/data/util/sqlcontainer/connection/J2EEConnectionPoolTest.java index 65a995120e..1463a27217 100644 --- a/server/tests/src/com/vaadin/data/util/sqlcontainer/connection/J2EEConnectionPoolTest.java +++ b/server/tests/src/com/vaadin/data/util/sqlcontainer/connection/J2EEConnectionPoolTest.java @@ -7,9 +7,8 @@ import javax.naming.Context; import javax.naming.NamingException; import javax.sql.DataSource; -import junit.framework.Assert; - import org.easymock.EasyMock; +import org.junit.Assert; import org.junit.Test; public class J2EEConnectionPoolTest { diff --git a/server/tests/src/com/vaadin/data/util/sqlcontainer/connection/SimpleJDBCConnectionPoolTest.java b/server/tests/src/com/vaadin/data/util/sqlcontainer/connection/SimpleJDBCConnectionPoolTest.java index 541ab8da5b..99ad420229 100644 --- a/server/tests/src/com/vaadin/data/util/sqlcontainer/connection/SimpleJDBCConnectionPoolTest.java +++ b/server/tests/src/com/vaadin/data/util/sqlcontainer/connection/SimpleJDBCConnectionPoolTest.java @@ -3,9 +3,8 @@ package com.vaadin.data.util.sqlcontainer.connection; import java.sql.Connection; import java.sql.SQLException; -import junit.framework.Assert; - import org.easymock.EasyMock; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/server/tests/src/com/vaadin/data/util/sqlcontainer/filters/BetweenTest.java b/server/tests/src/com/vaadin/data/util/sqlcontainer/filters/BetweenTest.java index da4cfe4522..16171f67bc 100644 --- a/server/tests/src/com/vaadin/data/util/sqlcontainer/filters/BetweenTest.java +++ b/server/tests/src/com/vaadin/data/util/sqlcontainer/filters/BetweenTest.java @@ -1,8 +1,7 @@ package com.vaadin.data.util.sqlcontainer.filters; -import junit.framework.Assert; - import org.easymock.EasyMock; +import org.junit.Assert; import org.junit.Test; import com.vaadin.data.Item; diff --git a/server/tests/src/com/vaadin/data/util/sqlcontainer/filters/CompareTest.java b/server/tests/src/com/vaadin/data/util/sqlcontainer/filters/CompareTest.java index c8faa71e66..252acd81fc 100644 --- a/server/tests/src/com/vaadin/data/util/sqlcontainer/filters/CompareTest.java +++ b/server/tests/src/com/vaadin/data/util/sqlcontainer/filters/CompareTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/server/tests/src/com/vaadin/data/util/sqlcontainer/query/QueryBuilderTest.java b/server/tests/src/com/vaadin/data/util/sqlcontainer/query/QueryBuilderTest.java index f635b23ebd..596f28cf5e 100644 --- a/server/tests/src/com/vaadin/data/util/sqlcontainer/query/QueryBuilderTest.java +++ b/server/tests/src/com/vaadin/data/util/sqlcontainer/query/QueryBuilderTest.java @@ -2,9 +2,8 @@ package com.vaadin.data.util.sqlcontainer.query; import java.util.ArrayList; -import junit.framework.Assert; - import org.easymock.EasyMock; +import org.junit.Assert; import org.junit.Test; import com.vaadin.data.Container.Filter; diff --git a/server/tests/src/com/vaadin/data/util/sqlcontainer/query/TableQueryTest.java b/server/tests/src/com/vaadin/data/util/sqlcontainer/query/TableQueryTest.java index c275cd4363..f009fc505e 100644 --- a/server/tests/src/com/vaadin/data/util/sqlcontainer/query/TableQueryTest.java +++ b/server/tests/src/com/vaadin/data/util/sqlcontainer/query/TableQueryTest.java @@ -734,4 +734,4 @@ public class TableQueryTest { statement.execute(SQLTestsConstants.dropSchema); } } -}
\ No newline at end of file +} diff --git a/server/tests/src/com/vaadin/server/ConnectorResourceHandlerTest.java b/server/tests/src/com/vaadin/server/ConnectorResourceHandlerTest.java index 828c35ced3..a5746065d6 100644 --- a/server/tests/src/com/vaadin/server/ConnectorResourceHandlerTest.java +++ b/server/tests/src/com/vaadin/server/ConnectorResourceHandlerTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/server/tests/src/com/vaadin/server/DefaultDeploymentConfigurationTest.java b/server/tests/src/com/vaadin/server/DefaultDeploymentConfigurationTest.java index 45d9853537..7cbb73af17 100644 --- a/server/tests/src/com/vaadin/server/DefaultDeploymentConfigurationTest.java +++ b/server/tests/src/com/vaadin/server/DefaultDeploymentConfigurationTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/server/tests/src/com/vaadin/server/JSONSerializerTest.java b/server/tests/src/com/vaadin/server/JSONSerializerTest.java index 81fd997c4a..8c1967acb3 100644 --- a/server/tests/src/com/vaadin/server/JSONSerializerTest.java +++ b/server/tests/src/com/vaadin/server/JSONSerializerTest.java @@ -1,7 +1,7 @@ package com.vaadin.server; /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/server/tests/src/com/vaadin/server/MockServletConfig.java b/server/tests/src/com/vaadin/server/MockServletConfig.java index cd1201c249..d9d0e4d773 100644 --- a/server/tests/src/com/vaadin/server/MockServletConfig.java +++ b/server/tests/src/com/vaadin/server/MockServletConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/server/tests/src/com/vaadin/server/MockServletContext.java b/server/tests/src/com/vaadin/server/MockServletContext.java index 40d79190f6..031c83ae90 100644 --- a/server/tests/src/com/vaadin/server/MockServletContext.java +++ b/server/tests/src/com/vaadin/server/MockServletContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/server/tests/src/com/vaadin/server/MockVaadinSession.java b/server/tests/src/com/vaadin/server/MockVaadinSession.java index 1fb53cd368..660767e0d4 100644 --- a/server/tests/src/com/vaadin/server/MockVaadinSession.java +++ b/server/tests/src/com/vaadin/server/MockVaadinSession.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/server/tests/src/com/vaadin/server/VaadinGateInRequestTests.java b/server/tests/src/com/vaadin/server/VaadinGateInRequestTests.java index 017613661e..4478b4cf39 100644 --- a/server/tests/src/com/vaadin/server/VaadinGateInRequestTests.java +++ b/server/tests/src/com/vaadin/server/VaadinGateInRequestTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/server/tests/src/com/vaadin/server/VaadinHttpAndPortletRequestTests.java b/server/tests/src/com/vaadin/server/VaadinHttpAndPortletRequestTests.java index 01d501c4fb..a87eb1870e 100644 --- a/server/tests/src/com/vaadin/server/VaadinHttpAndPortletRequestTests.java +++ b/server/tests/src/com/vaadin/server/VaadinHttpAndPortletRequestTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/server/tests/src/com/vaadin/server/VaadinLiferayRequestTests.java b/server/tests/src/com/vaadin/server/VaadinLiferayRequestTests.java index 074941a556..8ccd649ea4 100644 --- a/server/tests/src/com/vaadin/server/VaadinLiferayRequestTests.java +++ b/server/tests/src/com/vaadin/server/VaadinLiferayRequestTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of @@ -36,4 +36,4 @@ public class VaadinLiferayRequestTests extends return spy; } -}
\ No newline at end of file +} diff --git a/server/tests/src/com/vaadin/server/VaadinPortletServiceTests.java b/server/tests/src/com/vaadin/server/VaadinPortletServiceTests.java index c3b2d6b1d4..f7a69c2edb 100644 --- a/server/tests/src/com/vaadin/server/VaadinPortletServiceTests.java +++ b/server/tests/src/com/vaadin/server/VaadinPortletServiceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/server/tests/src/com/vaadin/server/VaadinPortletTests.java b/server/tests/src/com/vaadin/server/VaadinPortletTests.java index 93f8fd0778..f92aa0dcaa 100644 --- a/server/tests/src/com/vaadin/server/VaadinPortletTests.java +++ b/server/tests/src/com/vaadin/server/VaadinPortletTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/server/tests/src/com/vaadin/server/VaadinServiceTest.java b/server/tests/src/com/vaadin/server/VaadinServiceTest.java index 77eb155378..51325067d2 100644 --- a/server/tests/src/com/vaadin/server/VaadinServiceTest.java +++ b/server/tests/src/com/vaadin/server/VaadinServiceTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/server/tests/src/com/vaadin/server/VaadinServletConfigurationTest.java b/server/tests/src/com/vaadin/server/VaadinServletConfigurationTest.java index 58b44dc3db..65698d2c44 100644 --- a/server/tests/src/com/vaadin/server/VaadinServletConfigurationTest.java +++ b/server/tests/src/com/vaadin/server/VaadinServletConfigurationTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of @@ -24,9 +24,8 @@ import java.util.Properties; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; -import junit.framework.Assert; - import org.easymock.EasyMock; +import org.junit.Assert; import org.junit.Test; import com.vaadin.annotations.VaadinServletConfiguration; diff --git a/server/tests/src/com/vaadin/server/VaadinServletTest.java b/server/tests/src/com/vaadin/server/VaadinServletTest.java index be21586be4..566c4ce70a 100644 --- a/server/tests/src/com/vaadin/server/VaadinServletTest.java +++ b/server/tests/src/com/vaadin/server/VaadinServletTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/server/tests/src/com/vaadin/server/VaadinSessionTest.java b/server/tests/src/com/vaadin/server/VaadinSessionTest.java index edc78ba8d7..b710ee483f 100644 --- a/server/tests/src/com/vaadin/server/VaadinSessionTest.java +++ b/server/tests/src/com/vaadin/server/VaadinSessionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of @@ -23,9 +23,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSessionBindingEvent; -import junit.framework.Assert; - import org.easymock.EasyMock; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/server/tests/src/com/vaadin/server/VaadinWebSpherePortalRequestTests.java b/server/tests/src/com/vaadin/server/VaadinWebSpherePortalRequestTests.java index 0da85c7111..a1abfbd280 100644 --- a/server/tests/src/com/vaadin/server/VaadinWebSpherePortalRequestTests.java +++ b/server/tests/src/com/vaadin/server/VaadinWebSpherePortalRequestTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of @@ -36,4 +36,4 @@ public class VaadinWebSpherePortalRequestTests extends return spy; } -}
\ No newline at end of file +} diff --git a/server/tests/src/com/vaadin/server/communication/MetadataWriterTest.java b/server/tests/src/com/vaadin/server/communication/MetadataWriterTest.java new file mode 100644 index 0000000000..dee37ddc7f --- /dev/null +++ b/server/tests/src/com/vaadin/server/communication/MetadataWriterTest.java @@ -0,0 +1,95 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.server.communication; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.io.StringWriter; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; + +import com.vaadin.server.SystemMessages; +import com.vaadin.server.VaadinSession; +import com.vaadin.server.WrappedSession; +import com.vaadin.ui.UI; + +public class MetadataWriterTest { + + private UI ui; + private VaadinSession session; + private StringWriter writer; + private SystemMessages messages; + + @Before + public void setup() { + ui = Mockito.mock(UI.class); + session = Mockito.mock(VaadinSession.class); + Mockito.when(ui.getSession()).thenReturn(session); + writer = new StringWriter(); + messages = Mockito.mock(SystemMessages.class); + } + + private void disableSessionExpirationMessages(SystemMessages messages) { + when(messages.isSessionExpiredNotificationEnabled()).thenReturn(true); + when(messages.getSessionExpiredMessage()).thenReturn(null); + when(messages.getSessionExpiredCaption()).thenReturn(null); + } + + @Test + public void writeAsyncTag() throws Exception { + new MetadataWriter().write(ui, writer, false, true, messages); + Assert.assertEquals("{\"async\":true}", writer.getBuffer().toString()); + } + + @Test + public void writeRepaintTag() throws Exception { + new MetadataWriter().write(ui, writer, true, false, messages); + Assert.assertEquals("{\"repaintAll\":true}", writer.getBuffer() + .toString()); + } + + @Test + public void writeRepaintAndAsyncTag() throws Exception { + new MetadataWriter().write(ui, writer, true, true, messages); + Assert.assertEquals("{\"repaintAll\":true, \"async\":true}", writer + .getBuffer().toString()); + } + + @Test + public void writeRedirectWithExpiredSession() throws Exception { + disableSessionExpirationMessages(messages); + + new MetadataWriter().write(ui, writer, false, false, messages); + Assert.assertEquals("{}", writer.getBuffer().toString()); + } + + @Test + public void writeRedirectWithActiveSession() throws Exception { + WrappedSession wrappedSession = mock(WrappedSession.class); + when(session.getSession()).thenReturn(wrappedSession); + + disableSessionExpirationMessages(messages); + + new MetadataWriter().write(ui, writer, false, false, messages); + Assert.assertEquals( + "{\"timedRedirect\":{\"interval\":15,\"url\":\"\"}}", writer + .getBuffer().toString()); + } +} diff --git a/server/tests/src/com/vaadin/tests/data/converter/ConverterFactory.java b/server/tests/src/com/vaadin/tests/data/converter/ConverterFactory.java index 306e2f0405..32c9dc6604 100644 --- a/server/tests/src/com/vaadin/tests/data/converter/ConverterFactory.java +++ b/server/tests/src/com/vaadin/tests/data/converter/ConverterFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/server/tests/src/com/vaadin/tests/data/converter/TestAnyEnumToStringConverter.java b/server/tests/src/com/vaadin/tests/data/converter/TestAnyEnumToStringConverter.java index e21382069f..64b06f651e 100644 --- a/server/tests/src/com/vaadin/tests/data/converter/TestAnyEnumToStringConverter.java +++ b/server/tests/src/com/vaadin/tests/data/converter/TestAnyEnumToStringConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/server/tests/src/com/vaadin/tests/data/converter/TestSpecificEnumToStringConverter.java b/server/tests/src/com/vaadin/tests/data/converter/TestSpecificEnumToStringConverter.java index 8ce7b8eab8..75c742775f 100644 --- a/server/tests/src/com/vaadin/tests/data/converter/TestSpecificEnumToStringConverter.java +++ b/server/tests/src/com/vaadin/tests/data/converter/TestSpecificEnumToStringConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/server/tests/src/com/vaadin/tests/data/converter/TestStringToBigDecimalConverter.java b/server/tests/src/com/vaadin/tests/data/converter/TestStringToBigDecimalConverter.java index 5db33691b6..b8e74c7572 100644 --- a/server/tests/src/com/vaadin/tests/data/converter/TestStringToBigDecimalConverter.java +++ b/server/tests/src/com/vaadin/tests/data/converter/TestStringToBigDecimalConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/server/tests/src/com/vaadin/tests/data/converter/TestStringToLongConverter.java b/server/tests/src/com/vaadin/tests/data/converter/TestStringToLongConverter.java index 3210703445..0e95975c17 100644 --- a/server/tests/src/com/vaadin/tests/data/converter/TestStringToLongConverter.java +++ b/server/tests/src/com/vaadin/tests/data/converter/TestStringToLongConverter.java @@ -2,9 +2,10 @@ package com.vaadin.tests.data.converter; import java.util.Locale; -import junit.framework.Assert; import junit.framework.TestCase; +import org.junit.Assert; + import com.vaadin.data.util.converter.Converter; import com.vaadin.data.util.converter.ReverseConverter; import com.vaadin.data.util.converter.StringToLongConverter; diff --git a/server/tests/src/com/vaadin/tests/event/EventRouterTest.java b/server/tests/src/com/vaadin/tests/event/EventRouterTest.java index dbbeaf778e..aeb460c49e 100644 --- a/server/tests/src/com/vaadin/tests/event/EventRouterTest.java +++ b/server/tests/src/com/vaadin/tests/event/EventRouterTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/server/tests/src/com/vaadin/tests/server/TestAssertionsEnabled.java b/server/tests/src/com/vaadin/tests/server/TestAssertionsEnabled.java index f94cff391f..7e120cb9dd 100644 --- a/server/tests/src/com/vaadin/tests/server/TestAssertionsEnabled.java +++ b/server/tests/src/com/vaadin/tests/server/TestAssertionsEnabled.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/server/tests/src/com/vaadin/tests/server/TestClientMethodSerialization.java b/server/tests/src/com/vaadin/tests/server/TestClientMethodSerialization.java index 1e0210dc63..41b71a37fa 100644 --- a/server/tests/src/com/vaadin/tests/server/TestClientMethodSerialization.java +++ b/server/tests/src/com/vaadin/tests/server/TestClientMethodSerialization.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/server/tests/src/com/vaadin/tests/server/TestSerialization.java b/server/tests/src/com/vaadin/tests/server/TestSerialization.java index a52821a919..3c18035dab 100644 --- a/server/tests/src/com/vaadin/tests/server/TestSerialization.java +++ b/server/tests/src/com/vaadin/tests/server/TestSerialization.java @@ -136,4 +136,4 @@ public class TestSerialization extends TestCase { return dummyGetter; } } -}
\ No newline at end of file +} diff --git a/server/tests/src/com/vaadin/tests/server/component/ComponentSizeParseTest.java b/server/tests/src/com/vaadin/tests/server/component/ComponentSizeParseTest.java index 11c0d10998..2083d1f473 100644 --- a/server/tests/src/com/vaadin/tests/server/component/ComponentSizeParseTest.java +++ b/server/tests/src/com/vaadin/tests/server/component/ComponentSizeParseTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbsFieldValueConversions.java b/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbsFieldValueConversions.java index 85116dd152..beb32e7dba 100644 --- a/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbsFieldValueConversions.java +++ b/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbsFieldValueConversions.java @@ -2,9 +2,9 @@ package com.vaadin.tests.server.component.abstractfield; import java.util.Locale; -import junit.framework.Assert; import junit.framework.TestCase; +import org.junit.Assert; import org.junit.Test; import com.vaadin.data.util.MethodProperty; diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractorderedlayout/LayoutSettingsOnReplace.java b/server/tests/src/com/vaadin/tests/server/component/abstractorderedlayout/LayoutSettingsOnReplace.java index 0af21d8cb8..fd951f1692 100644 --- a/server/tests/src/com/vaadin/tests/server/component/abstractorderedlayout/LayoutSettingsOnReplace.java +++ b/server/tests/src/com/vaadin/tests/server/component/abstractorderedlayout/LayoutSettingsOnReplace.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractsinglecomponentcontainer/TestRemoveFromParentLocking.java b/server/tests/src/com/vaadin/tests/server/component/abstractsinglecomponentcontainer/TestRemoveFromParentLocking.java index 26443ead2b..fd4a1df766 100644 --- a/server/tests/src/com/vaadin/tests/server/component/abstractsinglecomponentcontainer/TestRemoveFromParentLocking.java +++ b/server/tests/src/com/vaadin/tests/server/component/abstractsinglecomponentcontainer/TestRemoveFromParentLocking.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/server/tests/src/com/vaadin/tests/server/component/calendar/CalendarBasics.java b/server/tests/src/com/vaadin/tests/server/component/calendar/CalendarBasics.java index 5926cfa1ca..ab2bc7c8c0 100644 --- a/server/tests/src/com/vaadin/tests/server/component/calendar/CalendarBasics.java +++ b/server/tests/src/com/vaadin/tests/server/component/calendar/CalendarBasics.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/server/tests/src/com/vaadin/tests/server/component/calendar/ContainerDataSource.java b/server/tests/src/com/vaadin/tests/server/component/calendar/ContainerDataSource.java index d5b0d5d9c8..030abc0eb2 100644 --- a/server/tests/src/com/vaadin/tests/server/component/calendar/ContainerDataSource.java +++ b/server/tests/src/com/vaadin/tests/server/component/calendar/ContainerDataSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/server/tests/src/com/vaadin/tests/server/component/colorpicker/ColorConversions.java b/server/tests/src/com/vaadin/tests/server/component/colorpicker/ColorConversions.java new file mode 100644 index 0000000000..46d72a6ae6 --- /dev/null +++ b/server/tests/src/com/vaadin/tests/server/component/colorpicker/ColorConversions.java @@ -0,0 +1,57 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.server.component.colorpicker; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +import com.vaadin.shared.ui.colorpicker.Color; + +public class ColorConversions { + + @Test + public void convertHSL2RGB() { + + int rgb = Color.HSLtoRGB(100, 50, 50); + Color c = new Color(rgb); + assertEquals(106, c.getRed()); + assertEquals(191, c.getGreen()); + assertEquals(64, c.getBlue()); + assertEquals("#6abf40", c.getCSS()); + + rgb = Color.HSLtoRGB(0, 50, 50); + c = new Color(rgb); + assertEquals(191, c.getRed()); + assertEquals(64, c.getGreen()); + assertEquals(64, c.getBlue()); + assertEquals("#bf4040", c.getCSS()); + + rgb = Color.HSLtoRGB(50, 0, 50); + c = new Color(rgb); + assertEquals(128, c.getRed()); + assertEquals(128, c.getGreen()); + assertEquals(128, c.getBlue()); + assertEquals("#808080", c.getCSS()); + + rgb = Color.HSLtoRGB(50, 100, 0); + c = new Color(rgb); + assertEquals(0, c.getRed(), 0); + assertEquals(0, c.getGreen(), 0); + assertEquals(0, c.getBlue(), 0); + assertEquals("#000000", c.getCSS()); + } +} diff --git a/server/tests/src/com/vaadin/tests/server/component/csslayout/CssLayoutListeners.java b/server/tests/src/com/vaadin/tests/server/component/csslayout/CssLayoutListeners.java index 21a48888d6..ee75d6ed59 100644 --- a/server/tests/src/com/vaadin/tests/server/component/csslayout/CssLayoutListeners.java +++ b/server/tests/src/com/vaadin/tests/server/component/csslayout/CssLayoutListeners.java @@ -10,4 +10,4 @@ public class CssLayoutListeners extends AbstractListenerMethodsTest { testListenerAddGetRemove(CssLayout.class, LayoutClickEvent.class, LayoutClickListener.class); } -}
\ No newline at end of file +} diff --git a/server/tests/src/com/vaadin/tests/server/component/datefield/DateFieldConverterTest.java b/server/tests/src/com/vaadin/tests/server/component/datefield/DateFieldConverterTest.java index 25ee0a38a9..f5467b2d18 100644 --- a/server/tests/src/com/vaadin/tests/server/component/datefield/DateFieldConverterTest.java +++ b/server/tests/src/com/vaadin/tests/server/component/datefield/DateFieldConverterTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/server/tests/src/com/vaadin/tests/server/component/fieldgroup/CaseInsensitiveBinding.java b/server/tests/src/com/vaadin/tests/server/component/fieldgroup/CaseInsensitiveBinding.java index e571576990..ea34d8b04e 100644 --- a/server/tests/src/com/vaadin/tests/server/component/fieldgroup/CaseInsensitiveBinding.java +++ b/server/tests/src/com/vaadin/tests/server/component/fieldgroup/CaseInsensitiveBinding.java @@ -82,4 +82,4 @@ public class CaseInsensitiveBinding { assertTrue("This".equals(form.firstName.getValue())); } -}
\ No newline at end of file +} diff --git a/server/tests/src/com/vaadin/tests/server/component/gridlayout/DefaultAlignment.java b/server/tests/src/com/vaadin/tests/server/component/gridlayout/DefaultAlignment.java index 2faa65d1f2..244f1f9e45 100644 --- a/server/tests/src/com/vaadin/tests/server/component/gridlayout/DefaultAlignment.java +++ b/server/tests/src/com/vaadin/tests/server/component/gridlayout/DefaultAlignment.java @@ -1,7 +1,6 @@ package com.vaadin.tests.server.component.gridlayout; -import junit.framework.Assert; - +import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/server/tests/src/com/vaadin/tests/server/component/label/LabelConverters.java b/server/tests/src/com/vaadin/tests/server/component/label/LabelConverters.java index 9d71db89a6..e6cecee1bf 100644 --- a/server/tests/src/com/vaadin/tests/server/component/label/LabelConverters.java +++ b/server/tests/src/com/vaadin/tests/server/component/label/LabelConverters.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/server/tests/src/com/vaadin/tests/server/component/orderedlayout/DefaultAlignment.java b/server/tests/src/com/vaadin/tests/server/component/orderedlayout/DefaultAlignment.java index 701373aba0..9497a13c0a 100644 --- a/server/tests/src/com/vaadin/tests/server/component/orderedlayout/DefaultAlignment.java +++ b/server/tests/src/com/vaadin/tests/server/component/orderedlayout/DefaultAlignment.java @@ -1,7 +1,6 @@ package com.vaadin.tests.server.component.orderedlayout; -import junit.framework.Assert; - +import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/server/tests/src/com/vaadin/tests/server/component/select/SelectListeners.java b/server/tests/src/com/vaadin/tests/server/component/select/SelectListeners.java index c7703303d3..2a1cc0deb0 100644 --- a/server/tests/src/com/vaadin/tests/server/component/select/SelectListeners.java +++ b/server/tests/src/com/vaadin/tests/server/component/select/SelectListeners.java @@ -17,4 +17,4 @@ public class SelectListeners extends AbstractListenerMethodsTest { testListenerAddGetRemove(Select.class, BlurEvent.class, BlurListener.class); } -}
\ No newline at end of file +} diff --git a/server/tests/src/com/vaadin/tests/server/component/slider/SliderTest.java b/server/tests/src/com/vaadin/tests/server/component/slider/SliderTest.java index d1dd87d923..f568da1392 100644 --- a/server/tests/src/com/vaadin/tests/server/component/slider/SliderTest.java +++ b/server/tests/src/com/vaadin/tests/server/component/slider/SliderTest.java @@ -1,8 +1,9 @@ package com.vaadin.tests.server.component.slider; -import junit.framework.Assert; import junit.framework.TestCase; +import org.junit.Assert; + import com.vaadin.ui.Slider; import com.vaadin.ui.Slider.ValueOutOfBoundsException; @@ -11,9 +12,9 @@ public class SliderTest extends TestCase { public void testOutOfBounds() { Slider s = new Slider(0, 10); s.setValue(0.0); - Assert.assertEquals(0.0, s.getValue()); + Assert.assertEquals(0.0, s.getValue().doubleValue(), 0.001); s.setValue(10.0); - Assert.assertEquals(10.0, s.getValue()); + Assert.assertEquals(10.0, s.getValue().doubleValue(), 0.001); try { s.setValue(20.0); fail("Should throw out of bounds exception"); diff --git a/server/tests/src/com/vaadin/tests/server/component/table/CacheUpdateExceptionCauses.java b/server/tests/src/com/vaadin/tests/server/component/table/CacheUpdateExceptionCauses.java index 7a7b488bc0..beb5da0885 100644 --- a/server/tests/src/com/vaadin/tests/server/component/table/CacheUpdateExceptionCauses.java +++ b/server/tests/src/com/vaadin/tests/server/component/table/CacheUpdateExceptionCauses.java @@ -16,8 +16,7 @@ package com.vaadin.tests.server.component.table; -import junit.framework.Assert; - +import org.junit.Assert; import org.junit.Test; import com.vaadin.ui.Table; diff --git a/server/tests/src/com/vaadin/tests/server/component/table/TableListeners.java b/server/tests/src/com/vaadin/tests/server/component/table/TableListeners.java index 6cc522f8c7..fbe5bb3146 100644 --- a/server/tests/src/com/vaadin/tests/server/component/table/TableListeners.java +++ b/server/tests/src/com/vaadin/tests/server/component/table/TableListeners.java @@ -38,4 +38,4 @@ public class TableListeners extends AbstractListenerMethodsTest { testListenerAddGetRemove(Table.class, ColumnReorderEvent.class, ColumnReorderListener.class); } -}
\ No newline at end of file +} diff --git a/server/tests/src/com/vaadin/tests/server/component/tree/TreeListeners.java b/server/tests/src/com/vaadin/tests/server/component/tree/TreeListeners.java index e14ebe739d..8d5b499264 100644 --- a/server/tests/src/com/vaadin/tests/server/component/tree/TreeListeners.java +++ b/server/tests/src/com/vaadin/tests/server/component/tree/TreeListeners.java @@ -24,4 +24,4 @@ public class TreeListeners extends AbstractListenerMethodsTest { testListenerAddGetRemove(Tree.class, CollapseEvent.class, CollapseListener.class); } -}
\ No newline at end of file +} diff --git a/server/tests/src/com/vaadin/tests/server/component/window/WindowAttach.java b/server/tests/src/com/vaadin/tests/server/component/window/WindowAttach.java index f9c93d307b..586300f650 100644 --- a/server/tests/src/com/vaadin/tests/server/component/window/WindowAttach.java +++ b/server/tests/src/com/vaadin/tests/server/component/window/WindowAttach.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/server/tests/src/com/vaadin/tests/server/component/window/WindowTest.java b/server/tests/src/com/vaadin/tests/server/component/window/WindowTest.java index 2cd19ee153..b74896b7a1 100644 --- a/server/tests/src/com/vaadin/tests/server/component/window/WindowTest.java +++ b/server/tests/src/com/vaadin/tests/server/component/window/WindowTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/server/tests/src/com/vaadin/tests/server/components/TestTextFieldValueChange.java b/server/tests/src/com/vaadin/tests/server/components/TestTextFieldValueChange.java index de838e339c..7c47b94df4 100644 --- a/server/tests/src/com/vaadin/tests/server/components/TestTextFieldValueChange.java +++ b/server/tests/src/com/vaadin/tests/server/components/TestTextFieldValueChange.java @@ -3,9 +3,8 @@ package com.vaadin.tests.server.components; import java.util.HashMap; import java.util.Map; -import junit.framework.Assert; - import org.easymock.EasyMock; +import org.junit.Assert; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.util.ObjectProperty; diff --git a/server/tests/src/com/vaadin/tests/server/navigator/ClassBasedViewProviderTest.java b/server/tests/src/com/vaadin/tests/server/navigator/ClassBasedViewProviderTest.java index 89cb352b6f..bc067ddb88 100644 --- a/server/tests/src/com/vaadin/tests/server/navigator/ClassBasedViewProviderTest.java +++ b/server/tests/src/com/vaadin/tests/server/navigator/ClassBasedViewProviderTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/server/tests/src/com/vaadin/tests/server/navigator/NavigatorTest.java b/server/tests/src/com/vaadin/tests/server/navigator/NavigatorTest.java index 5dc28757a7..ff6028648e 100644 --- a/server/tests/src/com/vaadin/tests/server/navigator/NavigatorTest.java +++ b/server/tests/src/com/vaadin/tests/server/navigator/NavigatorTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/server/tests/src/com/vaadin/tests/server/navigator/UriFragmentManagerTest.java b/server/tests/src/com/vaadin/tests/server/navigator/UriFragmentManagerTest.java index 4be34707e4..85de106e23 100644 --- a/server/tests/src/com/vaadin/tests/server/navigator/UriFragmentManagerTest.java +++ b/server/tests/src/com/vaadin/tests/server/navigator/UriFragmentManagerTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/server/tests/src/com/vaadin/tests/util/TestUtil.java b/server/tests/src/com/vaadin/tests/util/TestUtil.java index e84f9dd8b9..88ed017f91 100644 --- a/server/tests/src/com/vaadin/tests/util/TestUtil.java +++ b/server/tests/src/com/vaadin/tests/util/TestUtil.java @@ -2,7 +2,7 @@ package com.vaadin.tests.util; import java.util.Iterator; -import junit.framework.Assert; +import org.junit.Assert; public class TestUtil { public static void assertArrays(Object[] actualObjects, diff --git a/server/tests/src/com/vaadin/tests/util/UniqueSerializableTest.java b/server/tests/src/com/vaadin/tests/util/UniqueSerializableTest.java index db9b5c02fa..abdc6c1a5c 100644 --- a/server/tests/src/com/vaadin/tests/util/UniqueSerializableTest.java +++ b/server/tests/src/com/vaadin/tests/util/UniqueSerializableTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/server/tests/src/com/vaadin/ui/AbsFieldDataSourceLocaleChange.java b/server/tests/src/com/vaadin/ui/AbsFieldDataSourceLocaleChange.java index ff615e3d91..fa69fc46da 100644 --- a/server/tests/src/com/vaadin/ui/AbsFieldDataSourceLocaleChange.java +++ b/server/tests/src/com/vaadin/ui/AbsFieldDataSourceLocaleChange.java @@ -3,8 +3,7 @@ package com.vaadin.ui; import java.text.NumberFormat; import java.util.Locale; -import junit.framework.Assert; - +import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/server/tests/src/com/vaadin/ui/LabelDataSource.java b/server/tests/src/com/vaadin/ui/LabelDataSource.java index 21d3e56d57..b57e83df8e 100644 --- a/server/tests/src/com/vaadin/ui/LabelDataSource.java +++ b/server/tests/src/com/vaadin/ui/LabelDataSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/server/tests/src/com/vaadin/ui/UIInitRefreshTest.java b/server/tests/src/com/vaadin/ui/UIInitRefreshTest.java index a807e4b656..e4b31ca487 100644 --- a/server/tests/src/com/vaadin/ui/UIInitRefreshTest.java +++ b/server/tests/src/com/vaadin/ui/UIInitRefreshTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/server/tests/src/com/vaadin/util/ReflectToolsGetFieldValueByType.java b/server/tests/src/com/vaadin/util/ReflectToolsGetFieldValueByType.java index 540ffb852d..25f8ba7796 100644 --- a/server/tests/src/com/vaadin/util/ReflectToolsGetFieldValueByType.java +++ b/server/tests/src/com/vaadin/util/ReflectToolsGetFieldValueByType.java @@ -60,4 +60,4 @@ public class ReflectToolsGetFieldValueByType { } catch (Exception e) { } } -}
\ No newline at end of file +} diff --git a/server/tests/src/com/vaadin/util/ReflectToolsGetPrimitiveFieldValue.java b/server/tests/src/com/vaadin/util/ReflectToolsGetPrimitiveFieldValue.java index 1e1fafe31c..690f77d9a5 100644 --- a/server/tests/src/com/vaadin/util/ReflectToolsGetPrimitiveFieldValue.java +++ b/server/tests/src/com/vaadin/util/ReflectToolsGetPrimitiveFieldValue.java @@ -23,4 +23,4 @@ public class ReflectToolsGetPrimitiveFieldValue { } assertFalse(fieldValue instanceof Boolean); } -}
\ No newline at end of file +} diff --git a/server/tests/src/com/vaadin/util/TestCurrentInstance.java b/server/tests/src/com/vaadin/util/TestCurrentInstance.java index 09ef9514e5..666a0ef019 100644 --- a/server/tests/src/com/vaadin/util/TestCurrentInstance.java +++ b/server/tests/src/com/vaadin/util/TestCurrentInstance.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of |