Project

General

Profile

« Previous | Next » 

Revision 26d19e4f

Added by Cherian Mathew over 8 years ago

#5129 Extend export ui for remoting

View differences:

eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/BaseRemotingTest.java
9 9
package eu.etaxonomy.taxeditor.httpinvoker;
10 10

  
11 11
import java.io.File;
12
import java.io.FileInputStream;
12 13
import java.io.InputStream;
13 14
import java.lang.reflect.Field;
14 15
import java.net.URL;
......
67 68
    public static final Resource SERVER_PROPERTIES_FILE =
68 69
            new ClassPathResource("server.properties");
69 70

  
70
    public static final Resource EDITOR_DATASOURCES_FILE =
71
            new ClassPathResource(".cdmLibrary/writableResources/cdm.datasources.xml");
71
//    public static final Resource EDITOR_DATASOURCES_FILE =
72
//            new ClassPathResource(".cdmLibrary/writableResources/cdm.datasources.xml");
72 73

  
73 74
    //private static CdmApplicationRemoteController remoteApplicationController;
74 75
    private static ICdmRemoteSource cdmRemoteSource;
......
90 91
    @BeforeClass
91 92
    public static void initializeBaseRemotingTest() {
92 93

  
93
        //NOTE: Run this the cdmTest H2 DB whenever it needs to be
94
        //      recreated e.g. after a model change
95 94
        DatabaseUnitils.disableConstraints();
96 95

  
97 96
        try {
98 97
            String userHomeDirPath;
99 98
            Bundle bundle = Platform.getBundle("eu.etaxonomy.taxeditor.test");
100
            // if bundle is null then we are running as junit test in eclipse
101
            if(bundle == null) {
102
                userHomeDirPath = EDITOR_DATASOURCES_FILE.getFile().getParentFile().getParentFile().getParent();
103
            } else {
104
                // ... else we are running in maven which requires loading the dir via the
105
                // classpath bundle
106
                URL userHomeDirURL = bundle.getEntry("src/test/resources");
107
                File userHomeDir = new File(FileLocator.resolve(userHomeDirURL).toURI());
108
                userHomeDirPath = userHomeDir.getAbsolutePath();
109
            }
99

  
100
            URL userHomeDirURL = bundle.getEntry("src/test/resources");
101
            File userHomeDir = new File(FileLocator.resolve(userHomeDirURL).toURI());
102
            userHomeDirPath = userHomeDir.getAbsolutePath();
103

  
110 104

  
111 105

  
112 106
            logger.info("Setting user.home to " + userHomeDirPath);
......
116 110

  
117 111

  
118 112
            Properties prop = new Properties();
119
            InputStream inputStream = SERVER_PROPERTIES_FILE.getInputStream();
113

  
114
            URL serverPropertiesURL = bundle.getEntry("src/test/resources/server.properties");
115
            File serverPropertiesFile = new File(FileLocator.resolve(serverPropertiesURL).toURI());
116
            InputStream inputStream = new FileInputStream(serverPropertiesFile);
120 117

  
121 118
            if (inputStream != null) {
122 119
                prop.load(inputStream);

Also available in: Unified diff