View Javadoc
1   /*
2    * junixsocket
3    *
4    * Copyright 2009-2026 Christian Kohlschütter
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  package org.newsclub.net.unix.selftest;
19  
20  import java.io.PrintWriter;
21  import java.util.LinkedHashMap;
22  import java.util.Map;
23  import java.util.Set;
24  import java.util.HashSet;
25  
26  /**
27   * Provides references to all tests that should be included in junixsocket-selftest.
28   *
29   * @author Christian Kohlschütter
30   */
31  public class SelftestProvider {
32    private final org.newsclub.net.unix.SelftestProvider commonSelftests =
33        new org.newsclub.net.unix.SelftestProvider();
34    private final org.newsclub.net.unix.tipc.SelftestProvider tipcSelftests =
35        new org.newsclub.net.unix.tipc.SelftestProvider();
36    private final org.newsclub.net.unix.vsock.SelftestProvider vsockSelftests =
37        new org.newsclub.net.unix.vsock.SelftestProvider();
38    private final org.newsclub.net.unix.rmi.SelftestProvider rmiSelftests =
39        new org.newsclub.net.unix.rmi.SelftestProvider();
40    private final org.newsclub.net.unix.ssl.SelftestProvider sslSelftests =
41        new org.newsclub.net.unix.ssl.SelftestProvider();
42    private final org.newsclub.net.unix.darwin.SelftestProvider darwinSelftests =
43        new org.newsclub.net.unix.darwin.SelftestProvider();
44    private final org.newsclub.net.mysql.SelftestProvider mysqlSelftests =
45        new org.newsclub.net.mysql.SelftestProvider();
46    private final org.newsclub.net.unix.memory.SelftestProvider memorySelftests =
47        new org.newsclub.net.unix.memory.SelftestProvider();
48  
49    public Map<String, Class<?>[]> tests() throws Exception {
50      Map<String, Class<?>[]> tests = new LinkedHashMap<>();
51      tests.putAll(commonSelftests.tests());
52      tests.putAll(tipcSelftests.tests());
53      tests.putAll(vsockSelftests.tests());
54      tests.putAll(rmiSelftests.tests());
55      tests.putAll(sslSelftests.tests());
56      tests.putAll(darwinSelftests.tests());
57      tests.putAll(mysqlSelftests.tests());
58      tests.putAll(memorySelftests.tests());
59  
60      return tests;
61    }
62  
63    public Set<String> modulesDisabledByDefault() {
64      Set<String> set = new HashSet<>();
65      set.addAll(commonSelftests.modulesDisabledByDefault());
66      set.addAll(tipcSelftests.modulesDisabledByDefault());
67      set.addAll(vsockSelftests.modulesDisabledByDefault());
68      set.addAll(rmiSelftests.modulesDisabledByDefault());
69      set.addAll(sslSelftests.modulesDisabledByDefault());
70      set.addAll(darwinSelftests.modulesDisabledByDefault());
71      set.addAll(mysqlSelftests.modulesDisabledByDefault());
72      set.addAll(memorySelftests.modulesDisabledByDefault());
73      return set;
74    }
75  
76    public void printAdditionalProperties(PrintWriter out) {
77      commonSelftests.printAdditionalProperties(out);
78      tipcSelftests.printAdditionalProperties(out);
79      vsockSelftests.printAdditionalProperties(out);
80      rmiSelftests.printAdditionalProperties(out);
81      sslSelftests.printAdditionalProperties(out);
82      darwinSelftests.printAdditionalProperties(out);
83      mysqlSelftests.printAdditionalProperties(out);
84      memorySelftests.printAdditionalProperties(out);
85    }
86  }