Skip to main content
summaryrefslogtreecommitdiffstats
blob: 5ebf4adf054a38d06943be1d54060dac035b8ad1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*******************************************************************************
 * Copyright (c) 2013 Boeing.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Boeing - initial API and implementation
 *******************************************************************************/
package org.eclipse.osee.x.server.integration.tests.util;

import static org.eclipse.osee.orcs.rest.client.OseeClient.OSEE_APPLICATION_SERVER;
import java.util.HashMap;
import java.util.Map;
import org.databene.contiperf.junit.ContiPerfRule;
import org.databene.contiperf.report.CSVLatencyReportModule;
import org.databene.contiperf.report.CSVSummaryReportModule;
import org.databene.contiperf.report.HtmlReportModule;
import org.eclipse.osee.account.rest.client.AccountClient;
import org.eclipse.osee.account.rest.client.AccountClientStandaloneSetup;
import org.eclipse.osee.orcs.rest.client.OseeClient;
import org.eclipse.osee.orcs.rest.client.OseeClientStandaloneSetup;
import org.junit.rules.MethodRule;

public final class IntegrationUtil {

   private IntegrationUtil() {
      // Utility class
   }

   public static MethodRule createPerformanceRule() {
      return new ContiPerfRule(new HtmlReportModule(), new CSVSummaryReportModule(), new CSVLatencyReportModule());
   }

   public static OseeClient createClient() {
      Map<String, Object> config = createClientConfig();
      return OseeClientStandaloneSetup.createClient(config);
   }

   private static String getOseeApplicationServer() {
      return System.getProperty(OSEE_APPLICATION_SERVER, "http://localhost:8089");
   }

   private static Map<String, Object> createClientConfig() {
      Map<String, Object> config = new HashMap<String, Object>();
      config.put(OSEE_APPLICATION_SERVER, getOseeApplicationServer());
      return config;
   }

   public static AccountClient createAccountClient() {
      Map<String, Object> config = createClientConfig();
      return AccountClientStandaloneSetup.createClient(config);
   }

}

Back to the top