[New] Added transient perf test
This commit is contained in:
parent
061436e7ee
commit
c96465fcc6
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Privilege>
|
||||
|
||||
<Container>
|
||||
|
||||
<Parameters>
|
||||
<!-- parameters for the container itself -->
|
||||
<Parameter name="autoPersistOnPasswordChange" value="true" />
|
||||
</Parameters>
|
||||
|
||||
<EncryptionHandler class="li.strolch.privilege.handler.DefaultEncryptionHandler">
|
||||
<Parameters>
|
||||
<Parameter name="hashAlgorithm" value="SHA-256" />
|
||||
</Parameters>
|
||||
</EncryptionHandler>
|
||||
|
||||
<PersistenceHandler class="li.strolch.privilege.handler.XmlPersistenceHandler">
|
||||
<Parameters>
|
||||
<Parameter name="usersXmlFile" value="PrivilegeUsers.xml" />
|
||||
<Parameter name="rolesXmlFile" value="PrivilegeRoles.xml" />
|
||||
</Parameters>
|
||||
</PersistenceHandler>
|
||||
|
||||
<UserChallengeHandler class="li.strolch.privilege.handler.ConsoleUserChallengeHandler">
|
||||
</UserChallengeHandler>
|
||||
|
||||
</Container>
|
||||
|
||||
<Policies>
|
||||
<Policy name="DefaultPrivilege" class="li.strolch.privilege.policy.DefaultPrivilege" />
|
||||
</Policies>
|
||||
|
||||
</Privilege>
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Roles>
|
||||
<Role name="agent">
|
||||
<Privilege name="li.strolch.privilege.handler.SystemAction" policy="DefaultPrivilege">
|
||||
<Allow>li.strolch.runtime.privilege.StrolchSystemAction</Allow>
|
||||
<Allow>li.strolch.runtime.privilege.StrolchSystemActionWithResult</Allow>
|
||||
</Privilege>
|
||||
</Role>
|
||||
<Role name="AppUser">
|
||||
<Privilege name="li.strolch.service.api.Service" policy="DefaultPrivilege">
|
||||
<AllAllowed>true</AllAllowed>
|
||||
</Privilege>
|
||||
<Privilege name="li.strolch.model.query.StrolchQuery" policy="DefaultPrivilege">
|
||||
<AllAllowed>true</AllAllowed>
|
||||
</Privilege>
|
||||
</Role>
|
||||
</Roles>
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Users>
|
||||
<User userId="1" username="agent">
|
||||
<State>SYSTEM</State>
|
||||
<Roles>
|
||||
<Role>agent</Role>
|
||||
</Roles>
|
||||
</User>
|
||||
<User userId="2" username="transient" password="9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08">
|
||||
<Firstname>Application</Firstname>
|
||||
<Lastname>Administrator</Lastname>
|
||||
<State>ENABLED</State>
|
||||
<Locale>en_GB</Locale>
|
||||
<Roles>
|
||||
<Role>AppUser</Role>
|
||||
</Roles>
|
||||
<Properties>
|
||||
<Property name="realm" value="transient" />
|
||||
</Properties>
|
||||
</User>
|
||||
</Users>
|
|
@ -0,0 +1,48 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<StrolchConfiguration>
|
||||
<env id="dev">
|
||||
<Runtime>
|
||||
<applicationName>minimal</applicationName>
|
||||
<Properties>
|
||||
<locale>en</locale>
|
||||
<verbose>true</verbose>
|
||||
</Properties>
|
||||
</Runtime>
|
||||
<Component>
|
||||
<name>PrivilegeHandler</name>
|
||||
<api>li.strolch.runtime.privilege.PrivilegeHandler</api>
|
||||
<impl>li.strolch.runtime.privilege.DefaultStrolchPrivilegeHandler</impl>
|
||||
<Properties>
|
||||
<privilegeConfigFile>PrivilegeConfig.xml</privilegeConfigFile>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component>
|
||||
<name>RealmHandler</name>
|
||||
<api>li.strolch.agent.api.RealmHandler</api>
|
||||
<impl>li.strolch.agent.impl.DefaultRealmHandler</impl>
|
||||
<depends>PrivilegeHandler</depends>
|
||||
<Properties>
|
||||
<!--
|
||||
EMPTY = only inmemory
|
||||
TRANSIENT = only inmemory
|
||||
TRANSACTIONAL = only DB
|
||||
CACHED = inmemory with persistence in DB
|
||||
-->
|
||||
<realms>transient</realms>
|
||||
|
||||
<dataStoreMode.transient>EMPTY</dataStoreMode.transient>
|
||||
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component>
|
||||
<name>ServiceHandler</name>
|
||||
<api>li.strolch.service.api.ServiceHandler</api>
|
||||
<impl>li.strolch.service.api.DefaultServiceHandler</impl>
|
||||
<depends>RealmHandler</depends>
|
||||
<depends>PrivilegeHandler</depends>
|
||||
<Properties>
|
||||
<verbose>false</verbose>
|
||||
</Properties>
|
||||
</Component>
|
||||
</env>
|
||||
</StrolchConfiguration>
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* Copyright 2015 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.performance;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.postgresql.Driver;
|
||||
|
||||
import li.strolch.privilege.model.Certificate;
|
||||
import li.strolch.service.api.ServiceHandler;
|
||||
import li.strolch.testbase.runtime.RuntimeMock;
|
||||
import li.strolch.utils.helper.FileHelper;
|
||||
|
||||
/**
|
||||
* @author Robert von Burg <eitch@eitchnet.ch>
|
||||
*/
|
||||
public class PerformanceTransientTest {
|
||||
|
||||
public static final String RUNTIME_PATH = "target/runtime_transient_test/"; //$NON-NLS-1$
|
||||
public static final String CONFIG_SRC = "src/runtime_transient"; //$NON-NLS-1$
|
||||
|
||||
protected static RuntimeMock runtimeMock;
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeClass() throws Exception {
|
||||
|
||||
File rootPath = new File(RUNTIME_PATH);
|
||||
File configSrc = new File(CONFIG_SRC);
|
||||
runtimeMock = new RuntimeMock();
|
||||
runtimeMock.mockRuntime(rootPath, configSrc);
|
||||
runtimeMock.startContainer();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void runPerformanceTest() {
|
||||
|
||||
Certificate certificate = runtimeMock.getPrivilegeHandler().authenticate("transient", "test".getBytes());
|
||||
|
||||
ServiceHandler svcHandler = runtimeMock.getServiceHandler();
|
||||
svcHandler.doService(certificate, new PerformanceTestService(), new PerformanceTestArgument());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void afterClass() throws Exception {
|
||||
if (runtimeMock != null)
|
||||
runtimeMock.destroyRuntime();
|
||||
|
||||
File rootPath = new File(RUNTIME_PATH);
|
||||
if (rootPath.exists()) {
|
||||
FileHelper.deleteFile(rootPath, false);
|
||||
}
|
||||
|
||||
if (Driver.isRegistered())
|
||||
Driver.deregister();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue