Project

General

Profile

« Previous | Next » 

Revision fadab744

Added by Andreas Kohlbecker about 6 years ago

ref #7347 refacoring of the dataportal test suite for more flexibility

View differences:

src/main/java/eu/etaxonomy/dataportal/DataPortalContext.java
11 11
import java.net.URI;
12 12
import java.util.UUID;
13 13

  
14
import org.apache.log4j.Logger;
15

  
16 14
/**
17 15
 *
18 16
 * @author a.kohlbecker
19 17
 *
20 18
 */
21
public enum DataPortalContext {
22

  
23
    cichorieae,
24
    palmae,
25
    cyprus,
26
    floramalesiana,
27
    reference;
19
public class DataPortalContext {
28 20

  
29 21
    URI baseUri;
30 22
    URI cdmServerUri;
31 23
    UUID classificationUUID;
32 24
    String siteName; //TODO could be read with drush: $ drush vget site_name
33 25
    String themeName;
34

  
35

  
36
    public final Logger logger = Logger.getLogger(DataPortalContext.class);
37

  
38
    private DataPortalContext() {
39

  
40
        try {
41
            this.baseUri = TestConfiguration.getProperty(composePropertyKey("baseUri"), URI.class, true);
42
            this.cdmServerUri = TestConfiguration.getProperty(composePropertyKey("cdmServerUri"), URI.class, false);
43
            this.classificationUUID = TestConfiguration.getProperty(composePropertyKey("classificationUUID"), UUID.class, true);
44
            this.siteName = TestConfiguration.getProperty(composePropertyKey("siteName"));
45
        } catch (TestConfigurationException e) {
46
            logger.error("Configuration Error: ", e);
47
            System.exit(-1);
48
        }
49
    }
50

  
51
    private String composePropertyKey(String fieldName) {
52
        String key = this.getClass().getSimpleName().substring(0, 1).toLowerCase() + this.getClass().getSimpleName().substring(1) + "." + this.name() + "." + fieldName;
53
        return key;
26
    private String siteLabel;
27

  
28
    public DataPortalContext(URI baseUri, URI cdmServerUri, UUID classificationUUID, String siteName, String siteLabel) {
29
            this.baseUri = baseUri;
30
            this.cdmServerUri = cdmServerUri;
31
            this.classificationUUID = classificationUUID;
32
            this.siteName = siteName;
33
            this.siteLabel = siteLabel;
54 34
    }
55 35

  
56 36
    public URI getBaseUri() {
......
69 49
        return siteName;
70 50
    }
71 51

  
52
    public String getSiteLabel() {
53
        return siteLabel;
54
    }
55

  
56

  
57

  
58
    /**
59
     *
60
     * @param pageHeader
61
     *
62
     * @return The drupal site title as it is produced by drupal
63
     */
72 64
    public String prepareTitle(String pageHeader) {
73 65
        return pageHeader + " | " + getSiteName();
74 66
    }

Also available in: Unified diff