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
57
58
59
60
61
62
63
64
65
66
67
68
|
/*******************************************************************************
* Copyright (c) 2004, 2007 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.ats.util;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.util.Arrays;
import java.util.Collection;
import org.eclipse.osee.ats.api.user.IAtsUser;
import org.eclipse.osee.ats.core.client.config.AtsBulkLoad;
import org.eclipse.osee.ats.core.client.util.AtsUsersClient;
import org.eclipse.osee.ats.world.search.MyWorldSearchItem;
import org.eclipse.osee.ats.world.search.TeamWorldSearchItem;
import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
/**
* @author Andrew M. Finkbeiner
*/
public class AtsQueryPerformanceTests {
@org.junit.Test
public void testAtsBulkLoad() throws Exception {
long startTime = System.currentTimeMillis();
AtsBulkLoad.loadConfig(true);
long elapsedTime = System.currentTimeMillis() - startTime;
System.out.println(String.format("testAtsBulkLoad took %dms", elapsedTime));
assertTrue("testAtsBulkLoad should take less than 5000ms currently " + elapsedTime + "ms", elapsedTime < 5000);
}
@org.junit.Test
public void testTeamWorldSearchItem() throws Exception {
AtsBulkLoad.loadConfig(true);
TeamWorldSearchItem searchItem =
new TeamWorldSearchItem("Show Open OSEE Actions", Arrays.asList("ATS", "Define", "OTE"), false, false, true,
false, null, null, null, null, null);
long startTime = System.currentTimeMillis();
Collection<Artifact> artifacts = searchItem.performSearch(SearchType.Search);
long elapsedTime = System.currentTimeMillis() - startTime;
System.out.println(String.format("testTeamWorldSearchItem took %dms for %d artifacts", elapsedTime,
artifacts.size()));
assertTrue("No artifacts found", artifacts.size() > 0);
assertTrue("testTeamWorldSearchItem should take less than 2000ms; took " + elapsedTime + "ms", elapsedTime < 2000);
}
@org.junit.Test
public void testUserWorldSearch() throws Exception {
AtsBulkLoad.loadConfig(true);
IAtsUser user = AtsUsersClient.getUserByName("Finkbeiner, Andrew M");
assertNotNull("User does not exist", user);
MyWorldSearchItem search = new MyWorldSearchItem();
long startTime = System.currentTimeMillis();
Collection<Artifact> artifacts = search.searchIt(user);
long elapsedTime = System.currentTimeMillis() - startTime;
System.out.println(String.format("testUserWorldSearch took %dms for %d artifacts", elapsedTime, artifacts.size()));
assertTrue("No artifacts found", artifacts.size() > 0);
assertTrue("testUserWorldSearch should take less than 2500ms currently " + elapsedTime + "ms", elapsedTime < 2500);
}
}
|