Project

General

Profile

Download (1.34 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
 *
3
 */
4
package eu.etaxonomy.dataportal.junit;
5

    
6
import org.apache.log4j.Logger;
7
import org.junit.AfterClass;
8
import org.junit.Assert;
9
import org.junit.BeforeClass;
10
import org.junit.runner.RunWith;
11
import org.openqa.selenium.WebDriver;
12

    
13
import eu.etaxonomy.dataportal.DataPortalContext;
14
import eu.etaxonomy.dataportal.DataPortalSite;
15
import eu.etaxonomy.dataportal.selenium.WebDriverFactory;
16

    
17
/**
18
 * @author a.kohlbecker
19
 *
20
 */
21
@RunWith(DataPortalContextSuite.class)
22
public abstract class CdmDataPortalTestBase extends Assert{
23

    
24
	public static final Logger logger = Logger.getLogger(CdmDataPortalTestBase.class);
25

    
26
	protected static WebDriver driver;
27

    
28
	private DataPortalContext context;
29

    
30
	public DataPortalContext getContext() {
31
		return context;
32
	}
33

    
34
	public void setContext(DataPortalContext context) {
35
		this.context = context;
36

    
37
	}
38

    
39
	@BeforeClass
40
	public static void setUpDriver() {
41
		logger.debug("@BeforeClass: setUpDriver()");
42
		driver = WebDriverFactory.newWebDriver();
43
	}
44

    
45
	@AfterClass
46
	public static void closeDriver() {
47
		logger.debug("@AfterClass: closeDriver()");
48
		if (driver != null) {
49
			driver.quit();
50
		}
51
	}
52

    
53
	/**
54
	 * Return the {@link DataPortalSite#getSiteUri()} of the currently active
55
	 * context as String
56
	 *
57
	 * @return string representation of the DataPortal base URI
58
	 */
59
	public String getBaseUrl() {
60
		return context.getSiteUri().toString();
61
	}
62

    
63

    
64
}
(2-2/3)