myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r1773026 - in /myfaces/tobago/trunk: tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/ tobago-core/src/main/java/org/apache/myface...
Date Wed, 07 Dec 2016 08:57:46 GMT
Author: lofwyr
Date: Wed Dec  7 08:57:45 2016
New Revision: 1773026

URL: http://svn.apache.org/viewvc?rev=1773026&view=rev
Log:
TOBAGO-1652: Improve code coverage of enums

Added:
    myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/layout/JustifyContentUnitTest.java
    myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/model/SelectableUnitTest.java
    myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/model/SwitchTypeUnitTest.java
    myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/sanitizer/
    myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/sanitizer/SanitizeModeUnitTest.java
Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SheetTagDeclaration.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeListboxTagDeclaration.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeTagDeclaration.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/HasSanitize.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/Selectable.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/sanitizer/SanitizeMode.java
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/SheetConfig.java

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SheetTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SheetTagDeclaration.java?rev=1773026&r1=1773025&r2=1773026&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SheetTagDeclaration.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SheetTagDeclaration.java
Wed Dec  7 08:57:45 2016
@@ -187,9 +187,9 @@ public interface SheetTagDeclaration
   @TagAttribute
   @UIComponentTagAttribute(
       type = "org.apache.myfaces.tobago.model.Selectable",
-      defaultValue = Selectable.STRING_MULTI,
+      defaultValue = Selectable.MULTI,
       allowedValues = {
-          Selectable.STRING_NONE, Selectable.STRING_SINGLE, Selectable.STRING_SINGLE_OR_NONE,
Selectable.STRING_MULTI
+          Selectable.NONE, Selectable.SINGLE, Selectable.SINGLE_OR_NONE, Selectable.MULTI
       },
       defaultCode = "org.apache.myfaces.tobago.model.Selectable.multi")
   void setSelectable(String selectable);

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeListboxTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeListboxTagDeclaration.java?rev=1773026&r1=1773025&r2=1773026&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeListboxTagDeclaration.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeListboxTagDeclaration.java
Wed Dec  7 08:57:45 2016
@@ -68,8 +68,8 @@ public interface TreeListboxTagDeclarati
   @TagAttribute
   @UIComponentTagAttribute(
       type = "org.apache.myfaces.tobago.model.Selectable",
-      defaultValue = Selectable.STRING_SINGLE,
-      allowedValues = {Selectable.STRING_SINGLE, Selectable.STRING_MULTI_LEAF_ONLY, Selectable.STRING_SINGLE_LEAF_ONLY},
+      defaultValue = Selectable.SINGLE,
+      allowedValues = {Selectable.SINGLE, Selectable.MULTI_LEAF_ONLY, Selectable.SINGLE_LEAF_ONLY},
       defaultCode = "org.apache.myfaces.tobago.model.Selectable.single")
   void setSelectable(String selectable);
 

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeTagDeclaration.java?rev=1773026&r1=1773025&r2=1773026&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeTagDeclaration.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeTagDeclaration.java
Wed Dec  7 08:57:45 2016
@@ -72,13 +72,13 @@ public interface TreeTagDeclaration
   @TagAttribute
   @UIComponentTagAttribute(
       type = "org.apache.myfaces.tobago.model.Selectable",
-      defaultValue = Selectable.STRING_MULTI,
+      defaultValue = Selectable.MULTI,
       allowedValues = {
-          Selectable.STRING_NONE,
-          Selectable.STRING_MULTI,
-          Selectable.STRING_SINGLE,
-          Selectable.STRING_MULTI_LEAF_ONLY,
-          Selectable.STRING_SINGLE_LEAF_ONLY},
+          Selectable.NONE,
+          Selectable.MULTI,
+          Selectable.SINGLE,
+          Selectable.MULTI_LEAF_ONLY,
+          Selectable.SINGLE_LEAF_ONLY},
       defaultCode = "org.apache.myfaces.tobago.model.Selectable.multi")
   void setSelectable(String selectable);
 

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/HasSanitize.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/HasSanitize.java?rev=1773026&r1=1773025&r2=1773026&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/HasSanitize.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/HasSanitize.java
Wed Dec  7 08:57:45 2016
@@ -37,8 +37,8 @@ public interface HasSanitize {
   @TagAttribute
   @UIComponentTagAttribute(
       type = "org.apache.myfaces.tobago.sanitizer.SanitizeMode",
-      defaultValue = SanitizeMode.STRING_AUTO,
-      allowedValues = {SanitizeMode.STRING_AUTO, SanitizeMode.STRING_NEVER},
+      defaultValue = SanitizeMode.AUTO,
+      allowedValues = {SanitizeMode.AUTO, SanitizeMode.NEVER},
       defaultCode = "org.apache.myfaces.tobago.sanitizer.SanitizeMode.auto")
   void setSanitize(String sanitize);
 }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/Selectable.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/Selectable.java?rev=1773026&r1=1773025&r2=1773026&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/Selectable.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/Selectable.java
Wed Dec  7 08:57:45 2016
@@ -70,67 +70,31 @@ public enum Selectable {
    */
   multiCascade;
 
-  /** @deprecated  */
-  @Deprecated
-  public static final Selectable NONE = none;
+  public static final String NONE = "none";
 
-  /** @deprecated  */
-  @Deprecated
-  public static final Selectable MULTI = multi;
+  public static final String MULTI = "multi";
 
-  /** @deprecated  */
-  @Deprecated
-  public static final Selectable SINGLE = single;
+  public static final String SINGLE = "single";
 
-  /** @deprecated  */
-  @Deprecated
-  public static final Selectable SINGLE_OR_NONE = singleOrNone;
+  public static final String SINGLE_OR_NONE = "singleOrNone";
 
-  /** @deprecated  */
-  @Deprecated
-  public static final Selectable MULTI_LEAF_ONLY = multiLeafOnly;
+  public static final String MULTI_LEAF_ONLY = "multiLeafOnly";
 
-  /** @deprecated  */
-  @Deprecated
-  public static final Selectable SINGLE_LEAF_ONLY = singleLeafOnly;
+  public static final String SINGLE_LEAF_ONLY = "singleLeafOnly";
 
-  /** @deprecated  */
-  @Deprecated
-  public static final Selectable SIBLING = sibling;
+  public static final String SIBLING = "sibling";
 
-  /** @deprecated  */
-  @Deprecated
-  public static final Selectable SIBLING_LEAF_ONLY = siblingLeafOnly;
+  public static final String SIBLING_LEAF_ONLY = "siblingLeafOnly";
 
-  /** @deprecated  */
-  @Deprecated
-  public static final Selectable MULTI_CASCADE = multiCascade;
+  public static final String MULTI_CASCADE = "multiCascade";
 
-  public static final String STRING_NONE = "none";
-
-  public static final String STRING_MULTI = "multi";
-
-  public static final String STRING_SINGLE = "single";
-
-  public static final String STRING_SINGLE_OR_NONE = "singleOrNone";
-
-  public static final String STRING_MULTI_LEAF_ONLY = "multiLeafOnly";
-
-  public static final String STRING_SINGLE_LEAF_ONLY = "singleLeafOnly";
-
-  public static final String STRING_SIBLING = "sibling";
-
-  public static final String STRING_SIBLING_LEAF_ONLY = "siblingLeafOnly";
-
-  public static final String STRING_MULTI_CASCADE = "multiCascade";
-
-  public static final Set<Selectable> SHEET_VALUES = EnumSet.of(
+  private static final Set<Selectable> SHEET_VALUES = EnumSet.of(
       none,
       multi,
       single,
       singleOrNone);
 
-  public static final Set<Selectable> TREE_VALUES = EnumSet.of(
+  private static final Set<Selectable> TREE_VALUES = EnumSet.of(
       none,
       multi,
       single,
@@ -138,7 +102,7 @@ public enum Selectable {
       singleLeafOnly,
       multiCascade);
 
-  public static final Set<Selectable> TREE_LISTBOX_VALUES = EnumSet.of(
+  private static final Set<Selectable> TREE_LISTBOX_VALUES = EnumSet.of(
       single,
       singleLeafOnly,
       multiLeafOnly);

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/sanitizer/SanitizeMode.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/sanitizer/SanitizeMode.java?rev=1773026&r1=1773025&r2=1773026&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/sanitizer/SanitizeMode.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/sanitizer/SanitizeMode.java
Wed Dec  7 08:57:45 2016
@@ -23,6 +23,6 @@ public enum SanitizeMode {
   auto,
   never;
 
-  public static final String STRING_AUTO = "auto";
-  public static final String STRING_NEVER = "never";
+  public static final String AUTO = "auto";
+  public static final String NEVER = "never";
 }

Added: myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/layout/JustifyContentUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/layout/JustifyContentUnitTest.java?rev=1773026&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/layout/JustifyContentUnitTest.java
(added)
+++ myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/layout/JustifyContentUnitTest.java
Wed Dec  7 08:57:45 2016
@@ -0,0 +1,31 @@
+/*
+ * 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.myfaces.tobago.layout;
+
+import org.apache.myfaces.tobago.util.EnumUnitTest;
+import org.junit.Test;
+
+public class JustifyContentUnitTest extends EnumUnitTest {
+
+  @Test
+  public void testNames() throws IllegalAccessException, NoSuchFieldException {
+    testNames(JustifyContent.class);
+  }
+}

Added: myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/model/SelectableUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/model/SelectableUnitTest.java?rev=1773026&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/model/SelectableUnitTest.java
(added)
+++ myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/model/SelectableUnitTest.java
Wed Dec  7 08:57:45 2016
@@ -0,0 +1,31 @@
+/*
+ * 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.myfaces.tobago.model;
+
+import org.apache.myfaces.tobago.util.EnumUnitTest;
+import org.junit.Test;
+
+public class SelectableUnitTest extends EnumUnitTest {
+
+  @Test
+  public void testNames() throws IllegalAccessException, NoSuchFieldException {
+    testNames(Selectable.class);
+  }
+}

Added: myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/model/SwitchTypeUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/model/SwitchTypeUnitTest.java?rev=1773026&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/model/SwitchTypeUnitTest.java
(added)
+++ myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/model/SwitchTypeUnitTest.java
Wed Dec  7 08:57:45 2016
@@ -0,0 +1,31 @@
+/*
+ * 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.myfaces.tobago.model;
+
+import org.apache.myfaces.tobago.util.EnumUnitTest;
+import org.junit.Test;
+
+public class SwitchTypeUnitTest extends EnumUnitTest {
+
+  @Test
+  public void testNames() throws IllegalAccessException, NoSuchFieldException {
+    testNames(SwitchType.class);
+  }
+}

Added: myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/sanitizer/SanitizeModeUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/sanitizer/SanitizeModeUnitTest.java?rev=1773026&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/sanitizer/SanitizeModeUnitTest.java
(added)
+++ myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/sanitizer/SanitizeModeUnitTest.java
Wed Dec  7 08:57:45 2016
@@ -0,0 +1,31 @@
+/*
+ * 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.myfaces.tobago.sanitizer;
+
+import org.apache.myfaces.tobago.util.EnumUnitTest;
+import org.junit.Test;
+
+public class SanitizeModeUnitTest extends EnumUnitTest {
+
+  @Test
+  public void testNames() throws IllegalAccessException, NoSuchFieldException {
+    testNames(SanitizeMode.class);
+  }
+}

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/SheetConfig.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/SheetConfig.java?rev=1773026&r1=1773025&r2=1773026&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/SheetConfig.java
(original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/SheetConfig.java
Wed Dec  7 08:57:45 2016
@@ -23,6 +23,8 @@ import org.apache.myfaces.tobago.layout.
 import org.apache.myfaces.tobago.model.Selectable;
 
 import javax.faces.model.SelectItem;
+import java.util.HashSet;
+import java.util.Set;
 
 public class SheetConfig {
 
@@ -53,7 +55,13 @@ public class SheetConfig {
     sheetDirectPagingPosition = ShowPosition.center;
     sheetPagePagingPosition = ShowPosition.right;
     sheetPagingPositionItems = createSheetItems(ShowPosition.values());
-    sheetSelectableItems = createSheetItems(Selectable.SHEET_VALUES.toArray());
+    final Set<Selectable> selectableSupportedBySheet = new HashSet<Selectable>();
+    for (Selectable selectable : Selectable.values()) {
+      if (selectable.isSupportedBySheet()) {
+        selectableSupportedBySheet.add(selectable);
+      }
+    }
+    sheetSelectableItems = createSheetItems(selectableSupportedBySheet.toArray());
     selectable = Selectable.singleOrNone;
     showDirectLinksArrows = false;
     showPageRangeArrows = true;



Mime
View raw message