blob: 00cd11ff8e33577f5202ec723b5b3eba0d3c6e37 (
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
57
58
59
60
61
62
63
64
65
66
67
|
/*******************************************************************************
* Copyright (c) 2011 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.client.integration.tests;
import static org.junit.Assert.assertTrue;
import org.eclipse.osee.ats.client.demo.DemoUsers;
import org.eclipse.osee.ats.client.demo.DemoUtil;
import org.eclipse.osee.ats.client.demo.PopulateDemoActions;
import org.eclipse.osee.framework.core.client.ClientSessionManager;
import org.eclipse.osee.framework.core.client.OseeClientSession;
import org.eclipse.osee.framework.core.exception.OseeStateException;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.framework.jdk.core.util.OseeProperties;
import org.eclipse.osee.framework.skynet.core.UserManager;
import org.eclipse.osee.framework.ui.skynet.render.RenderingUtil;
import org.junit.Assert;
import org.junit.BeforeClass;
/**
* @author Donald G. Dunne
*/
public class PopulateDemoDatabaseTest {
@BeforeClass
public static void setup() throws Exception {
if (!DemoUtil.isDbInitSuccessful()) {
throw new OseeStateException("DbInit must be successful to continue");
}
OseeProperties.setIsInTest(true);
assertTrue("Demo Application Server must be running",
ClientSessionManager.getAuthenticationProtocols().contains("demo"));
RenderingUtil.setPopupsAllowed(false);
DemoUtil.setPopulateDbSuccessful(false);
}
@org.junit.Test
public void testPopulateDemoDb() {
System.out.println("\nBegin Populate Demo DB...");
try {
ClientSessionManager.releaseSession();
// Re-authenticate so we can continue
OseeClientSession session = ClientSessionManager.getSession();
UserManager.releaseUser();
Assert.assertEquals("Must run populate as Joe Smith", DemoUsers.Joe_Smith.getUserId(), session.getUserId());
Assert.assertEquals("Must run populate as Joe Smith", DemoUsers.Joe_Smith.getUserId(),
UserManager.getUser().getUserId());
PopulateDemoActions populateDemoActions = new PopulateDemoActions(null);
populateDemoActions.run(false);
DemoUtil.setPopulateDbSuccessful(true);
System.out.println("End Populate Demo DB...\n");
} catch (Exception ex) {
Assert.fail(Lib.exceptionToString(ex));
}
}
}
|