You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by li...@apache.org on 2018/04/03 06:50:46 UTC

[kylin] 08/10: minor, add test util SetAndUnsetSystemProp

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

liyang pushed a commit to branch sync
in repository https://gitbox.apache.org/repos/asf/kylin.git

commit 664095c98d03e03ab1e65622e4a36db7c0a09c13
Author: Li Yang <li...@apache.org>
AuthorDate: Sun Apr 1 16:34:05 2018 +0800

    minor, add test util SetAndUnsetSystemProp
---
 .../kylin/common/util/SetAndUnsetSystemProp.java   | 34 ++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/core-common/src/test/java/org/apache/kylin/common/util/SetAndUnsetSystemProp.java b/core-common/src/test/java/org/apache/kylin/common/util/SetAndUnsetSystemProp.java
new file mode 100644
index 0000000..83d0656
--- /dev/null
+++ b/core-common/src/test/java/org/apache/kylin/common/util/SetAndUnsetSystemProp.java
@@ -0,0 +1,34 @@
+/*
+ * 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.kylin.common.util;
+
+public class SetAndUnsetSystemProp implements AutoCloseable {
+    
+    final private String propName;
+    
+    public SetAndUnsetSystemProp(String propName, String value) {
+        this.propName = propName;
+        System.setProperty(propName, value);
+    }
+
+    @Override
+    public void close() {
+        System.clearProperty(propName);
+    }
+}

-- 
To stop receiving notification emails like this one, please contact
liyang@apache.org.