This is an automated email from the ASF dual-hosted git repository.

klund pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git

commit c9792aeab411b379c7417c38ecec3e4b9a00b158
Author: Kirk Lund <[email protected]>
AuthorDate: Thu Oct 4 13:53:00 2018 -0700

    GEODE-2644: Add LogWriterLevel enum and test
---
 .../geode/internal/logging/LogWriterLevel.java     | 39 ++++++++++++++++++++++
 .../sanctioned-geode-core-serializables.txt        |  1 +
 .../Configuration.java => LogWriterLevelTest.java} | 33 ++++++++----------
 3 files changed, 54 insertions(+), 19 deletions(-)

diff --git 
a/geode-core/src/main/java/org/apache/geode/internal/logging/LogWriterLevel.java
 
b/geode-core/src/main/java/org/apache/geode/internal/logging/LogWriterLevel.java
new file mode 100644
index 0000000..2415f98
--- /dev/null
+++ 
b/geode-core/src/main/java/org/apache/geode/internal/logging/LogWriterLevel.java
@@ -0,0 +1,39 @@
+/*
+ * 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.geode.internal.logging;
+
+public enum LogWriterLevel {
+
+  ALL(InternalLogWriter.ALL_LEVEL),
+  FINEST(InternalLogWriter.FINEST_LEVEL),
+  FINER(InternalLogWriter.FINER_LEVEL),
+  FINE(InternalLogWriter.FINE_LEVEL),
+  CONFIG(InternalLogWriter.CONFIG_LEVEL),
+  INFO(InternalLogWriter.INFO_LEVEL),
+  WARNING(InternalLogWriter.WARNING_LEVEL),
+  ERROR(InternalLogWriter.ERROR_LEVEL),
+  SEVERE(InternalLogWriter.SEVERE_LEVEL),
+  NONE(InternalLogWriter.NONE_LEVEL);
+
+  private final int logWriterLevel;
+
+  LogWriterLevel(int logWriterLevel) {
+    this.logWriterLevel = logWriterLevel;
+  }
+
+  public int getLogWriterLevel() {
+    return logWriterLevel;
+  }
+}
diff --git 
a/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-core-serializables.txt
 
b/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-core-serializables.txt
index 631ebfb..e9874d0 100644
--- 
a/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-core-serializables.txt
+++ 
b/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-core-serializables.txt
@@ -377,6 +377,7 @@ 
org/apache/geode/internal/hll/CardinalityMergeException,false
 
org/apache/geode/internal/jta/TransactionManagerImpl,true,5033392316185449821,globalTransactionMap:java/util/Map,gtxSet:java/util/SortedSet,isActive:boolean,transactionMap:java/util/Map
 
org/apache/geode/internal/jta/TransactionManagerImpl$GlobalTransactionComparator,false
 
org/apache/geode/internal/jta/UserTransactionImpl,true,2994652455204901910,storedTimeOut:int,tm:javax/transaction/TransactionManager
+org/apache/geode/internal/logging/LogWriterLevel,false,logWriterLevel:int
 org/apache/geode/internal/memcached/Command,false
 
org/apache/geode/internal/memcached/Command$1,false,processor:org/apache/geode/internal/memcached/CommandProcessor
 
org/apache/geode/internal/memcached/Command$10,false,processor:org/apache/geode/internal/memcached/CommandProcessor
diff --git 
a/geode-core/src/test/java/org/apache/geode/internal/logging/log4j/Configuration.java
 
b/geode-core/src/test/java/org/apache/geode/internal/logging/LogWriterLevelTest.java
similarity index 51%
rename from 
geode-core/src/test/java/org/apache/geode/internal/logging/log4j/Configuration.java
rename to 
geode-core/src/test/java/org/apache/geode/internal/logging/LogWriterLevelTest.java
index ec032c7..3e73ce7 100644
--- 
a/geode-core/src/test/java/org/apache/geode/internal/logging/log4j/Configuration.java
+++ 
b/geode-core/src/test/java/org/apache/geode/internal/logging/LogWriterLevelTest.java
@@ -12,32 +12,27 @@
  * or implied. See the License for the specific language governing permissions 
and limitations under
  * the License.
  */
-package org.apache.geode.internal.logging.log4j;
+package org.apache.geode.internal.logging;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.net.URL;
+import java.io.Serializable;
 
-import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang.SerializationUtils;
+import org.junit.Test;
 
-public class Configuration {
+public class LogWriterLevelTest {
 
-  private URL resource;
-  private String configFileName;
-
-  public Configuration(final URL resource, final String configFileName) {
-    this.resource = resource;
-    this.configFileName = configFileName;
+  @Test
+  public void isSerializable() {
+    assertThat(LogWriterLevel.ALL).isInstanceOf(Serializable.class);
   }
 
-  public File createConfigFileIn(final File targetFolder) throws IOException, 
URISyntaxException {
-    File targetFile = new File(targetFolder, this.configFileName);
-    IOUtils.copy(this.resource.openStream(), new FileOutputStream(targetFile));
-    assertThat(targetFile).hasSameContentAs(new File(this.resource.toURI()));
-    return targetFile;
+  @Test
+  public void serializes() {
+    LogWriterLevel logLevel = (LogWriterLevel) 
SerializationUtils.clone(LogWriterLevel.ALL);
+
+    
assertThat(logLevel).isEqualTo(LogWriterLevel.ALL).isSameAs(LogWriterLevel.ALL);
   }
+
 }

Reply via email to