This is an automated email from the ASF dual-hosted git repository.
solomax pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openmeetings.git
The following commit(s) were added to refs/heads/master by this push:
new d806125 [OPENMEETINGS-2078] tests should be fixed
d806125 is described below
commit d806125de6be60007fa0849c809282050e78cabc
Author: Maxim Solodovnik <[email protected]>
AuthorDate: Mon Jul 15 17:24:16 2019 +0700
[OPENMEETINGS-2078] tests should be fixed
---
.../backup/converter/EnumIcaseConverter.java | 53 ++++++++++++++++++++++
1 file changed, 53 insertions(+)
diff --git
a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/EnumIcaseConverter.java
b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/EnumIcaseConverter.java
new file mode 100644
index 0000000..9549562
--- /dev/null
+++
b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/EnumIcaseConverter.java
@@ -0,0 +1,53 @@
+/*
+ * 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.openmeetings.backup.converter;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+import org.apache.openmeetings.db.entity.basic.Configuration;
+import org.simpleframework.xml.convert.Converter;
+import org.simpleframework.xml.stream.InputNode;
+import org.simpleframework.xml.stream.OutputNode;
+
+public class EnumIcaseConverter implements Converter<Configuration.Type> {
+ private Map<String, Configuration.Type> icaseMap = new HashMap<>();
+
+ public EnumIcaseConverter() {
+ //default constructor is for export
+ }
+
+ public EnumIcaseConverter(Configuration.Type[] values) {
+ Arrays.stream(values).forEach(t ->
icaseMap.put(t.name().toUpperCase(Locale.ROOT), t));
+ }
+
+ @Override
+ public Configuration.Type read(InputNode node) throws Exception {
+ String name = node.getValue();
+ return name == null ? null :
icaseMap.get(name.toUpperCase(Locale.ROOT));
+ }
+
+ @Override
+ public void write(OutputNode node, Configuration.Type value) throws
Exception {
+ node.setData(true);
+ node.setValue(String.valueOf(value == null ? null :
value.name()));
+ }
+}