[Major] RuntimeMock now also copies data

This commit is contained in:
Robert von Burg 2013-12-25 19:05:00 +01:00
parent fe3cca7cb3
commit 2960fda079
5 changed files with 88 additions and 4 deletions

View File

@ -46,9 +46,9 @@ import org.junit.Test;
*/
public class ObserverUpdateTest {
public static final String RUNTIME_PATH = "target/strolchRuntime/"; //$NON-NLS-1$
public static final String RUNTIME_PATH = "target/observerUpdateStrolchRuntime/"; //$NON-NLS-1$
public static final String DB_STORE_PATH_DIR = "dbStore"; //$NON-NLS-1$
public static final String CONFIG_SRC = "src/test/resources/runtime/config"; //$NON-NLS-1$
public static final String CONFIG_SRC = "src/test/resources/cachedruntime"; //$NON-NLS-1$
protected static RuntimeMock runtimeMock;

View File

@ -29,9 +29,9 @@ import org.junit.BeforeClass;
public class XmlCachedDaoTest extends AbstractModelTest {
public static final String RUNTIME_PATH = "target/strolchRuntime/"; //$NON-NLS-1$
public static final String RUNTIME_PATH = "target/cachedStrolchRuntime/"; //$NON-NLS-1$
public static final String DB_STORE_PATH_DIR = "dbStore"; //$NON-NLS-1$
public static final String CONFIG_SRC = "src/test/resources/runtime/config"; //$NON-NLS-1$
public static final String CONFIG_SRC = "src/test/resources/cachedruntime"; //$NON-NLS-1$
private static final String DB_URL = "jdbc:postgresql://localhost/testdb"; //$NON-NLS-1$
private static final String DB_USERNAME = "testuser"; //$NON-NLS-1$

View File

@ -0,0 +1,57 @@
/*
* Copyright 2013 Robert von Burg <eitch@eitchnet.ch>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package li.strolch.persistence.postgresql.dao.test;
import java.io.File;
import java.sql.SQLException;
import li.strolch.testbase.runtime.AbstractModelTest;
import li.strolch.testbase.runtime.RuntimeMock;
import org.junit.AfterClass;
import org.junit.BeforeClass;
public class XmlTransactionalDaoTest extends AbstractModelTest {
public static final String RUNTIME_PATH = "target/transactionalStrolchRuntime/"; //$NON-NLS-1$
public static final String DB_STORE_PATH_DIR = "dbStore"; //$NON-NLS-1$
public static final String CONFIG_SRC = "src/test/resources/transactionalruntime"; //$NON-NLS-1$
protected static RuntimeMock runtimeMock;
@Override
protected RuntimeMock getRuntimeMock() {
return runtimeMock;
}
@BeforeClass
public static void beforeClass() throws SQLException {
XmlCachedDaoTest.dropSchema();
File rootPath = new File(RUNTIME_PATH);
File configSrc = new File(CONFIG_SRC);
runtimeMock = new RuntimeMock();
runtimeMock.mockRuntime(rootPath, configSrc);
new File(rootPath, DB_STORE_PATH_DIR).mkdir();
runtimeMock.startContainer(rootPath);
}
@AfterClass
public static void afterClass() {
runtimeMock.destroyRuntime();
}
}

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<StrolchConfiguration>
<Runtime>
<applicationName>StrolchPersistenceTest</applicationName>
<Properties>
<dataStoreMode>TRANSACTIONAL</dataStoreMode>
<verbose>true</verbose>
</Properties>
</Runtime>
<Component>
<name>PersistenceHandler</name>
<api>li.strolch.persistence.api.PersistenceHandler</api>
<impl>li.strolch.persistence.postgresql.PostgreSqlPersistenceHandler</impl>
<Properties>
<allowSchemaCreation>true</allowSchemaCreation>
<allowSchemaDrop>true</allowSchemaDrop>
<db.url>jdbc:postgresql://localhost/testdb</db.url>
<db.username>testuser</db.username>
<db.password>test</db.password>
</Properties>
</Component>
<Component>
<name>ObserverHandler</name>
<api>li.strolch.runtime.observer.ObserverHandler</api>
<impl>li.strolch.runtime.observer.DefaultObserverHandler</impl>
</Component>
</StrolchConfiguration>