http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/DateConverterForJavaUtilDateTest.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/DateConverterForJavaUtilDateTest.java b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/DateConverterForJavaUtilDateTest.java deleted file mode 100644 index fafe62e..0000000 --- a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/DateConverterForJavaUtilDateTest.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.apache.isis.viewer.wicket.ui.components.scalars.jdkdates; - -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; - -import java.util.Date; - -import org.jmock.Expectations; -import org.jmock.auto.Mock; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; - -import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2; -import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode; -import org.apache.isis.viewer.wicket.model.isis.WicketViewerSettings; - -public class DateConverterForJavaUtilDateTest { - - @Rule - public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES); - - @Mock - private WicketViewerSettings settings; - - @Before - public void setUp() throws Exception { - context.checking(new Expectations() { - { - allowing(settings).getDatePattern(); - will(returnValue("yyyy-MM-dd")); - allowing(settings).getDateTimePattern(); - will(returnValue("yyyy-MM-dd HH:mm")); - } - }); - } - - @Test - public void roundtripWhenParsingDateFormat() { - final DateConverterForJavaUtilDate converter = new DateConverterForJavaUtilDate(settings, 0); - final java.util.Date dt = converter.convertToObject("2013-05-11", null); - assertThat(dt, is(newJavaUtilDate(2013, 5, 11))); - - final String str = converter.convertToString(dt, null); - assertThat(str, is("2013-05-11 00:00")); - } - - @Test - public void roundtripWhenParsingDateTimeFormat() { - final DateConverterForJavaUtilDate converter = new DateConverterForJavaUtilDate(settings, 0); - final Date dt = converter.convertToObject("2013-05-11 00:00", null); - assertThat(dt, is(newJavaUtilDate(2013, 5, 11))); - - final String str = converter.convertToString(dt, null); - assertThat(str, is("2013-05-11 00:00")); - } - - @Test - public void roundtripWhenParsingDateFormatWithAdjustBy() { - final DateConverterForJavaUtilDate converter = new DateConverterForJavaUtilDate(settings, -1); - final Date dt = converter.convertToObject("2013-05-11", null); - assertThat(dt, is(newJavaUtilDate(2013, 5, 12))); - - final String str = converter.convertToString(dt, null); - assertThat(str, is("2013-05-11 00:00")); - } - - @Test - public void roundtripWhenParsingDateTimeFormatWithAdjustBy() { - final DateConverterForJavaUtilDate converter = new DateConverterForJavaUtilDate(settings, -1); - final Date dt = converter.convertToObject("2013-05-11 00:00", null); - assertThat(dt, is(newJavaUtilDate(2013, 5, 12))); - - final String str = converter.convertToString(dt, null); - assertThat(str, is("2013-05-11 00:00")); - } - - @SuppressWarnings("deprecation") - private java.util.Date newJavaUtilDate(int yyyy, int mm, int dd) { - return new java.util.Date(yyyy-1900, mm-1, dd); - } - -}
http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkmath/BigDecimalConverterWithScaleTest_roundtrip.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkmath/BigDecimalConverterWithScaleTest_roundtrip.java b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkmath/BigDecimalConverterWithScaleTest_roundtrip.java deleted file mode 100644 index 5528b61..0000000 --- a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkmath/BigDecimalConverterWithScaleTest_roundtrip.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.apache.isis.viewer.wicket.ui.components.scalars.jdkmath; - -import java.math.BigDecimal; -import java.util.Locale; - -import org.apache.wicket.util.convert.ConversionException; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; - -public class BigDecimalConverterWithScaleTest_roundtrip { - - final BigDecimal bd_123_45_scale2 = new BigDecimal("123.45").setScale(2); - final BigDecimal bd_123_4500_scale2 = new BigDecimal("123.4500").setScale(2); - - final BigDecimal bd_789123_45_scale2 = new BigDecimal("789123.45").setScale(2); - - final BigDecimal bd_123_45_scale4 = new BigDecimal("123.45").setScale(4); - final BigDecimal bd_123_4500_scale4 = new BigDecimal("123.4500").setScale(4); - - private BigDecimalConverterWithScale converter; - - @Rule - public ExpectedException exception = ExpectedException.none(); - - @Before - public void setUp() throws Exception { - converter = newConverter(2); - } - - @Test - public void scale2_english() { - - // when - final BigDecimal actual = converter.convertToObject("123.45", Locale.ENGLISH); - Assert.assertEquals(bd_123_4500_scale2, actual); - Assert.assertEquals(bd_123_45_scale2, actual); - - Assert.assertNotEquals(bd_123_4500_scale4, actual); - Assert.assertNotEquals(bd_123_45_scale4, actual); - - // when - String actualStr = converter.convertToString(actual, Locale.ENGLISH); - Assert.assertEquals("123.45", actualStr); - } - - @Test - public void scale4_english() { - converter = newConverter(4); - - final BigDecimal actual = converter.convertToObject("123.45", Locale.ENGLISH); - Assert.assertNotEquals(bd_123_4500_scale2, actual); - Assert.assertNotEquals(bd_123_45_scale2, actual); - - Assert.assertEquals(bd_123_4500_scale4, actual); - Assert.assertEquals(bd_123_45_scale4, actual); - - // when - String actualStr = converter.convertToString(actual, Locale.ENGLISH); - Assert.assertEquals("123.4500", actualStr); - } - - - @Test - public void scaleNull_english() { - converter = newConverter(null); - - final BigDecimal actual = converter.convertToObject("123.45", Locale.ENGLISH); - Assert.assertEquals(bd_123_4500_scale2, actual); - Assert.assertEquals(bd_123_45_scale2, actual); - - final BigDecimal actual2 = converter.convertToObject("123.4500", Locale.ENGLISH); - Assert.assertEquals(bd_123_4500_scale4, actual2); - Assert.assertEquals(bd_123_45_scale4, actual2); - } - - - @Test - public void scale2_italian() { - - final BigDecimal actual = converter.convertToObject("123,45", Locale.ITALIAN); - Assert.assertEquals(bd_123_4500_scale2, actual); - Assert.assertEquals(bd_123_45_scale2, actual); - - Assert.assertNotEquals(bd_123_4500_scale4, actual); - Assert.assertNotEquals(bd_123_45_scale4, actual); - } - - - @Test - public void scale2_english_withThousandSeparators() { - - exception.expect(ConversionException.class); - exception.expectMessage("Thousands separator ',' is not allowed in input"); - - converter.convertToObject("789,123.45", Locale.ENGLISH); - } - - @Test - public void scale2_english_withoutThousandSeparators() { - - // when - final BigDecimal actual = converter.convertToObject("789123.45", Locale.ENGLISH); - Assert.assertEquals(bd_789123_45_scale2, actual); - - // when - String actualStr = converter.convertToString(actual, Locale.ENGLISH); - Assert.assertEquals("789123.45", actualStr); - } - - @Test - public void scale2_english_tooLargeScale() { - - exception.expect(ConversionException.class); - exception.expectMessage("No more than 2 digits can be entered after the decimal place"); - - converter.convertToObject("123.454", Locale.ENGLISH); - } - - private BigDecimalConverterWithScale newConverter(Integer scale) { - return new BigDecimalConverterWithScale(scale); - } - -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/DateConverterForJodaDateTimeTest.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/DateConverterForJodaDateTimeTest.java b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/DateConverterForJodaDateTimeTest.java deleted file mode 100644 index 6ce5599..0000000 --- a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/DateConverterForJodaDateTimeTest.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.apache.isis.viewer.wicket.ui.components.scalars.jodatime; - -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; - -import org.jmock.Expectations; -import org.jmock.auto.Mock; -import org.joda.time.DateTime; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; - -import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2; -import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode; -import org.apache.isis.viewer.wicket.model.isis.WicketViewerSettings; - -public class DateConverterForJodaDateTimeTest { - - @Rule - public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES); - - @Mock - private WicketViewerSettings settings; - - @Before - public void setUp() throws Exception { - context.checking(new Expectations() { - { - allowing(settings).getDatePattern(); - will(returnValue("yyyy-MM-dd")); - allowing(settings).getDateTimePattern(); - will(returnValue("yyyy-MM-dd HH:mm")); - allowing(settings).getDatePickerPattern(); - will(returnValue("yy-mm-dd")); - } - }); - } - - - @Test - public void roundtripWhenParsingDateFormat() { - final DateConverterForJodaDateTime converter = new DateConverterForJodaDateTime(settings, 0); - final DateTime dt = converter.convertToObject("2013-05-11", null); - assertThat(dt, is(new DateTime(2013, 05, 11, 0, 0))); - - final String str = converter.convertToString(dt, null); - assertThat(str, is("2013-05-11 00:00")); - } - - @Test - public void roundtripWhenParsingDateTimeFormat() { - final DateConverterForJodaDateTime converter = new DateConverterForJodaDateTime(settings, 0); - final DateTime dt = converter.convertToObject("2013-05-11 00:00", null); - assertThat(dt, is(new DateTime(2013, 05, 11, 0, 0))); - - final String str = converter.convertToString(dt, null); - assertThat(str, is("2013-05-11 00:00")); - } - - @Test - public void roundtripWhenParsingDateFormatWithAdjustBy() { - final DateConverterForJodaDateTime converter = new DateConverterForJodaDateTime(settings, -1); - final DateTime dt = converter.convertToObject("2013-05-11", null); - assertThat(dt, is(new DateTime(2013, 05, 12, 0, 0))); - - final String str = converter.convertToString(dt, null); - assertThat(str, is("2013-05-11 00:00")); - } - - @Test - public void roundtripWhenParsingDateTimeFormatWithAdjustBy() { - final DateConverterForJodaDateTime converter = new DateConverterForJodaDateTime(settings, -1); - final DateTime dt = converter.convertToObject("2013-05-11 00:00", null); - assertThat(dt, is(new DateTime(2013, 05, 12, 0, 0))); - - final String str = converter.convertToString(dt, null); - assertThat(str, is("2013-05-11 00:00")); - } - - -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/DateConverterForJodaLocalDateTest.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/DateConverterForJodaLocalDateTest.java b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/DateConverterForJodaLocalDateTest.java deleted file mode 100644 index 13034cd..0000000 --- a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/DateConverterForJodaLocalDateTest.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.apache.isis.viewer.wicket.ui.components.scalars.jodatime; - -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; - -import org.jmock.Expectations; -import org.jmock.auto.Mock; -import org.joda.time.LocalDate; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; - -import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2; -import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode; -import org.apache.isis.viewer.wicket.model.isis.WicketViewerSettings; - -public class DateConverterForJodaLocalDateTest { - - @Rule - public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES); - - @Mock - private WicketViewerSettings settings; - - @Before - public void setUp() throws Exception { - context.checking(new Expectations() { - { - allowing(settings).getDatePattern(); - will(returnValue("yyyy-MM-dd")); - allowing(settings).getDatePickerPattern(); - will(returnValue("yy-mm-dd")); - } - }); - } - - @Test - public void roundtrip() { - final DateConverterForJodaLocalDate converter = new DateConverterForJodaLocalDate(settings, 0); - final LocalDate dt = converter.convertToObject("2013-05-11", null); - assertThat(dt, is(new LocalDate(2013, 05, 11))); - - final String str = converter.convertToString(dt, null); - assertThat(str, is("2013-05-11")); - } - - @Test - public void roundtripWithAdjustBy() { - final DateConverterForJodaLocalDate converter = new DateConverterForJodaLocalDate(settings, -1); - final LocalDate dt = converter.convertToObject("2013-05-11", null); - assertThat(dt, is(new LocalDate(2013, 05, 12))); - - final String str = converter.convertToString(dt, null); - assertThat(str, is("2013-05-11")); - } - -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/DateConverterForJodaLocalDateTimeTest.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/DateConverterForJodaLocalDateTimeTest.java b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/DateConverterForJodaLocalDateTimeTest.java deleted file mode 100644 index 2686f91..0000000 --- a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/DateConverterForJodaLocalDateTimeTest.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.apache.isis.viewer.wicket.ui.components.scalars.jodatime; - -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; - -import org.jmock.Expectations; -import org.jmock.auto.Mock; -import org.joda.time.LocalDateTime; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; - -import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2; -import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode; -import org.apache.isis.viewer.wicket.model.isis.WicketViewerSettings; - -public class DateConverterForJodaLocalDateTimeTest { - - @Rule - public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES); - - @Mock - private WicketViewerSettings settings; - - @Before - public void setUp() throws Exception { - context.checking(new Expectations() { - { - allowing(settings).getDatePattern(); - will(returnValue("yyyy-MM-dd")); - allowing(settings).getDateTimePattern(); - will(returnValue("yyyy-MM-dd HH:mm")); - allowing(settings).getDatePickerPattern(); - will(returnValue("yy-mm-dd")); - } - }); - } - - @Test - public void roundtripWhenParsingDateFormat() { - final DateConverterForJodaLocalDateTime converter = new DateConverterForJodaLocalDateTime(settings, 0); - final LocalDateTime dt = converter.convertToObject("2013-05-11", null); - assertThat(dt, is(new LocalDateTime(2013, 05, 11, 0, 0))); - - final String str = converter.convertToString(dt, null); - assertThat(str, is("2013-05-11 00:00")); - } - - @Test - public void roundtripWhenParsingDateTimeFormat() { - final DateConverterForJodaLocalDateTime converter = new DateConverterForJodaLocalDateTime(settings, 0); - final LocalDateTime dt = converter.convertToObject("2013-05-11 00:00", null); - assertThat(dt, is(new LocalDateTime(2013, 05, 11, 0, 0))); - - final String str = converter.convertToString(dt, null); - assertThat(str, is("2013-05-11 00:00")); - } - - @Test - public void roundtripWhenParsingDateFormatWithAdjustBy() { - final DateConverterForJodaLocalDateTime converter = new DateConverterForJodaLocalDateTime(settings, -1); - final LocalDateTime dt = converter.convertToObject("2013-05-11", null); - assertThat(dt, is(new LocalDateTime(2013, 05, 12, 0, 0))); - - final String str = converter.convertToString(dt, null); - assertThat(str, is("2013-05-11 00:00")); - } - - @Test - public void roundtripWhenParsingDateTimeFormatWithAdjustBy() { - final DateConverterForJodaLocalDateTime converter = new DateConverterForJodaLocalDateTime(settings, -1); - final LocalDateTime dt = converter.convertToObject("2013-05-11 00:00", null); - assertThat(dt, is(new LocalDateTime(2013, 05, 12, 0, 0))); - - final String str = converter.convertToString(dt, null); - assertThat(str, is("2013-05-11 00:00")); - } - - -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/widgets/valuechoices/FixedObjectAdapterMementoProviderTest.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/widgets/valuechoices/FixedObjectAdapterMementoProviderTest.java b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/widgets/valuechoices/FixedObjectAdapterMementoProviderTest.java deleted file mode 100644 index c151c44..0000000 --- a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/widgets/valuechoices/FixedObjectAdapterMementoProviderTest.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.apache.isis.viewer.wicket.ui.components.widgets.valuechoices; - -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import com.google.common.collect.Lists; -import org.jmock.Expectations; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2; -import org.apache.isis.viewer.wicket.model.isis.WicketViewerSettings; -import org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.nullValue; - -public class FixedObjectAdapterMementoProviderTest { - - @Rule - public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(JUnitRuleMockery2.Mode.INTERFACES_AND_CLASSES); - - private List<ObjectAdapterMemento> mementos; - - private ObjectAdapterMemento mockMemento1; - private ObjectAdapterMemento mockMemento2; - private ValueChoicesSelect2Panel.FixedObjectAdapterMementoProvider provider; - - @Before - public void setUp() throws Exception { - mockMemento1 = mock("mockMemento1"); - mockMemento2 = mock("mockMemento2"); - - mementos = Lists.newArrayList( - mockMemento1, mockMemento2 - ); - - WicketViewerSettings wicketViewerSettings = context.mock(WicketViewerSettings.class); - provider = new ValueChoicesSelect2Panel.FixedObjectAdapterMementoProvider(null, mementos, wicketViewerSettings); - } - - @Test - public void whenInList() throws Exception { - final Collection<ObjectAdapterMemento> mementos = provider.toChoices(Collections.singletonList("mockMemento1")); - Assert.assertThat(mementos.size(), is(1)); - Assert.assertThat(mementos.iterator().next(), is(mockMemento1)); - } - - @Test - public void whenNullPlaceholder() throws Exception { - final Collection<ObjectAdapterMemento> mementos = provider.toChoices(Collections.singletonList("$$_isis_null_$$")); - Assert.assertThat(mementos.size(), is(1)); - Assert.assertThat(mementos.iterator().next(), is(nullValue())); - } - - private ObjectAdapterMemento mock(final String id) { - final ObjectAdapterMemento mock = context.mock(ObjectAdapterMemento.class, id); - context.checking(new Expectations() {{ - allowing(mock).asString(); - will(returnValue(id)); - }}); - return mock; - } - -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/errors/JGrowlUtilTest.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/errors/JGrowlUtilTest.java b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/errors/JGrowlUtilTest.java deleted file mode 100644 index 4b33b6f..0000000 --- a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/errors/JGrowlUtilTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.apache.isis.viewer.wicket.ui.errors; - -import org.junit.Test; - -import static org.hamcrest.CoreMatchers.equalTo; -import static org.junit.Assert.assertThat; - -public class JGrowlUtilTest { - - @Test - public void testEscape() throws Exception { - - assertThat(JGrowlUtil.escape( - "double quotes \" and single quotes ' and <p>markup</p>"), equalTo( - "double quotes ' and single quotes ' and <p>markup</p>")); - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/fixtures/ActionFixtures.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/fixtures/ActionFixtures.java b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/fixtures/ActionFixtures.java deleted file mode 100644 index a11bf5e..0000000 --- a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/fixtures/ActionFixtures.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.apache.isis.viewer.wicket.ui.fixtures; - -import org.jmock.Expectations; -import org.jmock.Mockery; - -import org.apache.isis.applib.Identifier; -import org.apache.isis.applib.annotation.Where; -import org.apache.isis.core.commons.authentication.AuthenticationSession; -import org.apache.isis.core.metamodel.adapter.ObjectAdapter; -import org.apache.isis.core.metamodel.consent.ConsentAbstract; -import org.apache.isis.core.metamodel.facetapi.Facet; -import org.apache.isis.core.metamodel.spec.ActionType; -import org.apache.isis.core.metamodel.spec.ObjectSpecification; -import org.apache.isis.core.metamodel.spec.feature.ObjectAction; - -public final class ActionFixtures { - - private final Mockery context; - - public ActionFixtures(final Mockery context) { - this.context = context; - } - - public <T extends Facet> void getFacet(final ObjectAction mockAction, final Class<T> facetClass, final T returns) { - context.checking(new Expectations() { - { - allowing(mockAction).getFacet(with(facetClass)); - will(returnValue(returns)); - } - }); - } - - public void getName(final ObjectAction mockAction, final String returns) { - context.checking(new Expectations() { - { - allowing(mockAction).getName(); - will(returnValue(returns)); - } - }); - } - - public <T extends Facet> void getParameterCount(final ObjectAction mockAction, final int returns) { - context.checking(new Expectations() { - { - allowing(mockAction).getParameterCount(); - will(returnValue(returns)); - } - }); - } - - public void getType(final ObjectAction mockAction, final ActionType returns) { - context.checking(new Expectations() { - { - allowing(mockAction).getType(); - will(returnValue(returns)); - } - }); - } - - public void getIdentifier(final Mockery context, final ObjectAction mockAction, final Identifier returns) { - context.checking(new Expectations() { - { - allowing(mockAction).getIdentifier(); - will(returnValue(returns)); - } - }); - } - - public void getOnType(final ObjectAction mockAction, final ObjectSpecification returns) { - context.checking(new Expectations() { - { - allowing(mockAction).getOnType(); - will(returnValue(returns)); - } - }); - } - - public void isVisible(final ObjectAction mockAction, final boolean returns) { - context.checking(new Expectations() { - { - allowing(mockAction).isVisible(with(any(AuthenticationSession.class)), with(any(ObjectAdapter.class)), Where.ANYWHERE); - will(returnValue(ConsentAbstract.allowIf(returns))); - } - }); - } - - public void isUsable(final ObjectAction mockAction, final boolean returns) { - context.checking(new Expectations() { - { - allowing(mockAction).isUsable(with(any(AuthenticationSession.class)), with(any(ObjectAdapter.class)), Where.ANYWHERE); - will(returnValue(ConsentAbstract.allowIf(returns))); - } - }); - } - -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/fixtures/AdapterFixtures.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/fixtures/AdapterFixtures.java b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/fixtures/AdapterFixtures.java deleted file mode 100644 index 4d1252b..0000000 --- a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/fixtures/AdapterFixtures.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.apache.isis.viewer.wicket.ui.fixtures; - -import org.jmock.Expectations; -import org.jmock.Mockery; - -import org.apache.isis.core.metamodel.adapter.ObjectAdapter; - -public final class AdapterFixtures { - - private final Mockery context; - - public AdapterFixtures(final Mockery context) { - this.context = context; - } - - public void getOid(final ObjectAdapter mockAdapter, final Object returns) { - context.checking(new Expectations() { - { - allowing(mockAdapter).getOid(); - will(returnValue(returns)); - } - }); - } - -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/fixtures/Customers.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/fixtures/Customers.java b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/fixtures/Customers.java deleted file mode 100644 index c086183..0000000 --- a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/fixtures/Customers.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.apache.isis.viewer.wicket.ui.fixtures; - -public class Customers { - -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/fixtures/SpecFixtures.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/fixtures/SpecFixtures.java b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/fixtures/SpecFixtures.java deleted file mode 100644 index 996ac61..0000000 --- a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/fixtures/SpecFixtures.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.apache.isis.viewer.wicket.ui.fixtures; - -import org.jmock.Expectations; -import org.jmock.Mockery; - -import org.apache.isis.core.metamodel.spec.ObjectSpecification; - -public final class SpecFixtures { - - private final Mockery context; - - public SpecFixtures(final Mockery context) { - this.context = context; - } - - public void getFullName(final ObjectSpecification mockNoSpec, final String returns) { - context.checking(new Expectations() { - { - allowing(mockNoSpec).getFullIdentifier(); - will(returnValue(returns)); - } - }); - } - -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstractTest.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstractTest.java b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstractTest.java deleted file mode 100644 index fccbca6..0000000 --- a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstractTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.apache.isis.viewer.wicket.ui.pages; - -import org.junit.Test; - -import org.apache.isis.viewer.wicket.ui.util.CssClassAppender; - -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; - -public abstract class PageAbstractTest { - - public static class AsCssStyle extends PageAbstractTest { - - @Test - public void withSpacesAndCapitals() throws Exception { - assertThat(CssClassAppender.asCssStyle("Simple App"), is("simple-app")); - } - - @Test - public void withOtherCharacters() throws Exception { - assertThat(CssClassAppender.asCssStyle("Kitchen Sink (Demo) App"), is("kitchen-sink-demo-app")); - } - - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/core/pom.xml ---------------------------------------------------------------------- diff --git a/core/pom.xml b/core/pom.xml index 7e8e32b..2ef3932 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -122,6 +122,17 @@ <jetty.version>6.1.26</jetty.version> + <wicket.version>6.17.0</wicket.version> + <wicketstuff.version>6.17.0</wicketstuff.version> + + <wicket-webjars.version>0.4.3</wicket-webjars.version> + <wicket-bootstrap.version>0.9.7</wicket-bootstrap.version> + <wicket-source.version>6.0.0.8</wicket-source.version> + + <wicket-select2.version>2.2.3</wicket-select2.version> + <select2.version>3.5.1</select2.version> + <jquery-ui.version>1.10.4</jquery-ui.version> + <guice.version>3.0</guice.version> <picocontainer.version>2.14.3</picocontainer.version> @@ -1175,6 +1186,51 @@ ${license.additional-notes} <version>1.8.0-SNAPSHOT</version> </dependency> + + <!-- also for benefit of application developers, using scope=import --> + <dependency> + <groupId>org.apache.isis.viewer</groupId> + <artifactId>isis-viewer-wicket-applib</artifactId> + <version>1.8.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.isis.viewer</groupId> + <artifactId>isis-viewer-wicket-model</artifactId> + <version>1.8.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.isis.viewer</groupId> + <artifactId>isis-viewer-wicket-model</artifactId> + <version>1.8.0-SNAPSHOT</version> + <scope>test</scope> + <type>test-jar</type> + </dependency> + <dependency> + <groupId>org.apache.isis.viewer</groupId> + <artifactId>isis-viewer-wicket-ui</artifactId> + <version>1.8.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.isis.viewer</groupId> + <artifactId>isis-viewer-wicket-ui</artifactId> + <version>1.8.0-SNAPSHOT</version> + <scope>test</scope> + <type>test-jar</type> + </dependency> + <dependency> + <groupId>org.apache.isis.viewer</groupId> + <artifactId>isis-viewer-wicket-impl</artifactId> + <version>1.8.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.isis.viewer</groupId> + <artifactId>isis-viewer-wicket-impl</artifactId> + <version>1.8.0-SNAPSHOT</version> + <scope>test</scope> + <type>test-jar</type> + </dependency> + + <!-- Maven plugin --> <dependency> <groupId>org.apache.isis.tool</groupId> @@ -1384,6 +1440,270 @@ ${license.additional-notes} </exclusions> </dependency> + + + <!-- Wicket --> + <dependency> + <groupId>org.apache.wicket</groupId> + <artifactId>wicket</artifactId> + <version>${wicket.version}</version> + <type>pom</type> + </dependency> + + <dependency> + <groupId>org.apache.wicket</groupId> + <artifactId>wicket-core</artifactId> + <version>${wicket.version}</version> + <exclusions> + <exclusion> + <!-- for dependency convergence --> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.apache.wicket</groupId> + <artifactId>wicket-request</artifactId> + <version>${wicket.version}</version> + <exclusions> + <exclusion> + <!-- for dependency convergence --> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.apache.wicket</groupId> + <artifactId>wicket-util</artifactId> + <version>${wicket.version}</version> + <exclusions> + <exclusion> + <!-- for dependency convergence --> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.apache.wicket</groupId> + <artifactId>wicket-extensions</artifactId> + <version>${wicket.version}</version> + <exclusions> + <exclusion> + <!-- for dependency convergence --> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.apache.wicket</groupId> + <artifactId>wicket-datetime</artifactId> + <version>${wicket.version}</version> + <exclusions> + <exclusion> + <!-- for dependency convergence --> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.apache.wicket</groupId> + <artifactId>wicket-auth-roles</artifactId> + <version>${wicket.version}</version> + <exclusions> + <exclusion> + <!-- for dependency convergence --> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.apache.wicket</groupId> + <artifactId>wicket-guice</artifactId> + <version>${wicket.version}</version> + <exclusions> + <exclusion> + <!-- for dependency convergence --> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </exclusion> + <exclusion> + <!-- for Java7 compatibility (we don't use the proxying capability of this component) --> + <groupId>cglib</groupId> + <artifactId>cglib</artifactId> + </exclusion> + </exclusions> + </dependency> + + <!-- Wicket-Select2 --> + <dependency> + <groupId>com.vaynberg.wicket.select2</groupId> + <artifactId>wicket-select2</artifactId> + <version>${wicket-select2.version}</version> + <exclusions> + <exclusion> + <!-- for dependency convergence --> + <groupId>org.apache.wicket</groupId> + <artifactId>wicket-core</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.webjars</groupId> + <artifactId>select2</artifactId> + <version>${select2.version}</version> + </dependency> + + <dependency> + <groupId>org.webjars</groupId> + <artifactId>jquery-ui</artifactId> + <version>${jquery-ui.version}</version> + <exclusions> + <exclusion> + <groupId>org.webjars</groupId> + <artifactId>jquery</artifactId> + </exclusion> + </exclusions> + </dependency> + + <!-- Webjars --> + <dependency> + <groupId>de.agilecoders.wicket.webjars</groupId> + <artifactId>wicket-webjars</artifactId> + <version>${wicket-webjars.version}</version> + <exclusions> + <exclusion> + <!-- for dependency convergence --> + <groupId>org.apache.wicket</groupId> + <artifactId>wicket-core</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.wicket</groupId> + <artifactId>wicket-request</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>de.agilecoders.wicket</groupId> + <artifactId>wicket-bootstrap-core</artifactId> + <version>${wicket-bootstrap.version}</version> + <exclusions> + <exclusion> + <groupId>org.apache.wicket</groupId> + <artifactId>wicket-util</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.wicket</groupId> + <artifactId>wicket-request</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.wicket</groupId> + <artifactId>wicket-core</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.wicket</groupId> + <artifactId>wicket-extensions</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>de.agilecoders.wicket</groupId> + <artifactId>wicket-bootstrap-extensions</artifactId> + <version>${wicket-bootstrap.version}</version> + <exclusions> + <exclusion> + <groupId>org.apache.wicket</groupId> + <artifactId>wicket-util</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.wicket</groupId> + <artifactId>wicket-request</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.wicket</groupId> + <artifactId>wicket-core</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.wicket</groupId> + <artifactId>wicket-extensions</artifactId> + </exclusion> + <exclusion> + <groupId>org.webjars</groupId> + <artifactId>bootstrap</artifactId> + </exclusion> + <exclusion> + <groupId>org.webjars</groupId> + <artifactId>jquery</artifactId> + </exclusion> + <!-- exclude unused extensions --> + <exclusion> + <groupId>org.webjars</groupId> + <artifactId>jquerypp</artifactId> + </exclusion> + <exclusion> + <groupId>org.webjars</groupId> + <artifactId>jquery-ui</artifactId> + </exclusion> + <exclusion> + <groupId>org.webjars</groupId> + <artifactId>typeaheadjs</artifactId> + </exclusion> + <exclusion> + <groupId>org.webjars</groupId> + <artifactId>x-editable-bootstrap</artifactId> + </exclusion> + <exclusion> + <groupId>org.webjars</groupId> + <artifactId>spin-js</artifactId> + </exclusion> + <exclusion> + <groupId>com.google.javascript</groupId> + <artifactId>closure-compiler</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>de.agilecoders.wicket</groupId> + <artifactId>wicket-bootstrap-themes</artifactId> + <version>${wicket-bootstrap.version}</version> + <exclusions> + <exclusion> + <groupId>org.apache.wicket</groupId> + <artifactId>wicket-core</artifactId> + </exclusion> + </exclusions> + </dependency> + + + <dependency> + <groupId>net.ftlines.wicket-source</groupId> + <artifactId>wicket-source</artifactId> + <version>${wicket-source.version}</version> + <exclusions> + <exclusion> + <!-- for dependency convergence --> + <groupId>org.apache.wicket</groupId> + <artifactId>wicket-core</artifactId> + </exclusion> + </exclusions> + </dependency> + + <!-- predicate libraries --> <dependency> <groupId>org.hamcrest</groupId> @@ -1880,6 +2200,8 @@ ${license.additional-notes} <module>viewer-restfulobjects-rendering</module> <module>viewer-restfulobjects-server</module> + <module>viewer-wicket</module> + <module>maven-plugin</module> </modules> http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/core/viewer-wicket/NOTICE ---------------------------------------------------------------------- diff --git a/core/viewer-wicket/NOTICE b/core/viewer-wicket/NOTICE new file mode 100644 index 0000000..a93e145 --- /dev/null +++ b/core/viewer-wicket/NOTICE @@ -0,0 +1,7 @@ +Apache Isis +Copyright 2010-2014 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + + http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/core/viewer-wicket/applib/pom.xml ---------------------------------------------------------------------- diff --git a/core/viewer-wicket/applib/pom.xml b/core/viewer-wicket/applib/pom.xml new file mode 100644 index 0000000..a68ae9e --- /dev/null +++ b/core/viewer-wicket/applib/pom.xml @@ -0,0 +1,90 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you 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. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.isis.viewer</groupId> + <artifactId>isis-viewer-wicket</artifactId> + <version>1.8.0-SNAPSHOT</version> + </parent> + + <artifactId>isis-viewer-wicket-applib</artifactId> + <name>Isis Wicket Viewer Applib</name> + + <properties> + <siteBaseDir>..</siteBaseDir> + <relativeUrl>applib/</relativeUrl> + </properties> + + <!-- used in Site generation for relative references. --> + <url>http://isis.apache.org/${relativeUrl}</url> + + <build> + <resources> + <resource> + <filtering>false</filtering> + <directory>src/main/resources</directory> + </resource> + <resource> + <filtering>false</filtering> + <directory>src/main/java</directory> + <includes> + <include>**</include> + </includes> + <excludes> + <exclude>**/*.java</exclude> + </excludes> + </resource> + </resources> + </build> + + <dependencies> + + <dependency> + <groupId>org.apache.isis.core</groupId> + <artifactId>isis-core-applib</artifactId> + </dependency> + <dependency> + <groupId>org.apache.wicket</groupId> + <artifactId>wicket-core</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.isis.core</groupId> + <artifactId>isis-core-unittestsupport</artifactId> + <scope>test</scope> + </dependency> + + + <!-- LOGGING DEPENDENCIES - LOG4J --> + + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + </dependency> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + </dependency> + + </dependencies> +</project> http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/core/viewer-wicket/applib/src/main/java/org/apache/isis/viewer/wicket/viewer/applib/WicketDeveloperUtilitiesService.java ---------------------------------------------------------------------- diff --git a/core/viewer-wicket/applib/src/main/java/org/apache/isis/viewer/wicket/viewer/applib/WicketDeveloperUtilitiesService.java b/core/viewer-wicket/applib/src/main/java/org/apache/isis/viewer/wicket/viewer/applib/WicketDeveloperUtilitiesService.java new file mode 100644 index 0000000..83d03cc --- /dev/null +++ b/core/viewer-wicket/applib/src/main/java/org/apache/isis/viewer/wicket/viewer/applib/WicketDeveloperUtilitiesService.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.apache.isis.viewer.wicket.viewer.applib; + +import org.apache.wicket.Application; +import org.apache.isis.applib.annotation.Action; +import org.apache.isis.applib.annotation.RestrictTo; +import org.apache.isis.applib.annotation.SemanticsOf; +import org.apache.isis.applib.annotation.Where; + +public class WicketDeveloperUtilitiesService { + + /** + * Clears the i18n cache so that localized keys can be reloaded. + * + * <p> + * Have hidden this service because it seems that Wicket automatically invalidates + * the resource cache anyway if running in development/prototype mode. + * </p> + */ + @Action( + restrictTo = RestrictTo.PROTOTYPING, + hidden = Where.EVERYWHERE, + semantics = SemanticsOf.IDEMPOTENT + ) + public void resetI18nCache() { + Application.get() + .getResourceSettings() + .getLocalizer().clearCache(); + + } +} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/core/viewer-wicket/impl/pom.xml ---------------------------------------------------------------------- diff --git a/core/viewer-wicket/impl/pom.xml b/core/viewer-wicket/impl/pom.xml new file mode 100644 index 0000000..6bfe89d --- /dev/null +++ b/core/viewer-wicket/impl/pom.xml @@ -0,0 +1,110 @@ +<!-- +<?xml version="1.0" encoding="UTF-8"?> + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you 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. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.isis.viewer</groupId> + <artifactId>isis-viewer-wicket</artifactId> + <version>1.8.0-SNAPSHOT</version> + </parent> + + <name>Isis Wicket Viewer Implementation</name> + <artifactId>isis-viewer-wicket-impl</artifactId> + + <properties> + <siteBaseDir>..</siteBaseDir> + <relativeUrl>viewer/</relativeUrl> + </properties> + + <!-- used in Site generation for relative references. --> + <url>http://isis.apache.org/${relativeUrl}</url> + + <build> + <resources> + <resource> + <filtering>false</filtering> + <directory>src/main/resources</directory> + </resource> + <resource> + <filtering>false</filtering> + <directory>src/main/java</directory> + <includes> + <include>**</include> + </includes> + <excludes> + <exclude>**/*.java</exclude> + </excludes> + </resource> + </resources> + </build> + + <dependencies> + <dependency> + <groupId>org.apache.isis.viewer</groupId> + <artifactId>isis-viewer-wicket-ui</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.isis.core</groupId> + <artifactId>isis-core-unittestsupport</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.isis.core</groupId> + <artifactId>isis-core-runtime</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.geronimo.specs</groupId> + <artifactId>geronimo-servlet_2.5_spec</artifactId> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.wicket</groupId> + <artifactId>wicket-auth-roles</artifactId> + </dependency> + + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + </dependency> + + <dependency> + <groupId>net.ftlines.wicket-source</groupId> + <artifactId>wicket-source</artifactId> + </dependency> + + <dependency> + <groupId>com.google.inject</groupId> + <artifactId>guice-parent</artifactId> + <version>${guice.version}</version> + <type>pom</type> + </dependency> + + <dependency> + <groupId>de.agilecoders.wicket</groupId> + <artifactId>wicket-bootstrap-core</artifactId> + </dependency> + </dependencies> + +</project>
