Skip to content

Commit

Permalink
Fixing security wiring in the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Mar 18, 2014
1 parent 51a53cd commit 3484a35
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
5 changes: 5 additions & 0 deletions samples/samples-test/pom.xml
Expand Up @@ -92,6 +92,11 @@
<artifactId>audit-impl</artifactId>
<version>2.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.evolveum.midpoint.repo</groupId>
<artifactId>security-impl</artifactId>
<version>2.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.evolveum.midpoint.repo</groupId>
<artifactId>repo-test-util</artifactId>
Expand Down
Expand Up @@ -16,6 +16,7 @@
package com.evolveum.midpoint.samples.test;

import com.evolveum.midpoint.model.api.ModelService;
import com.evolveum.midpoint.model.test.AbstractModelIntegrationTest;
import com.evolveum.midpoint.prism.PrismContext;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.prism.query.EqualsFilter;
Expand All @@ -35,13 +36,15 @@
import com.evolveum.midpoint.xml.ns._public.common.common_2a.ResourceType;
import com.evolveum.midpoint.xml.ns._public.common.common_2a.UserType;
import com.evolveum.prism.xml.ns._public.query_2.QueryType;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.annotation.DirtiesContext.ClassMode;
import org.springframework.test.context.ContextConfiguration;
import org.testng.annotations.Test;

import javax.xml.bind.JAXBException;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
Expand All @@ -60,7 +63,7 @@
*/
@ContextConfiguration(locations = {"classpath:ctx-samples-test-main.xml"})
@DirtiesContext(classMode=ClassMode.AFTER_CLASS)
public class TestSampleImport extends AbstractIntegrationTest {
public class TestSampleImport extends AbstractModelIntegrationTest {

private static final String SAMPLE_DIRECTORY_NAME = "../";
private static final String SCHEMA_DIRECTORY_NAME = SAMPLE_DIRECTORY_NAME + "schema/";
Expand All @@ -80,16 +83,15 @@ public TestSampleImport() throws JAXBException {

@Override
public void initSystem(Task initTask, OperationResult initResult) throws Exception {
// SchemaRegistry schemaRegistry = prismContext.getSchemaRegistry();
// schemaRegistry.loadPrismSchemasFromDirectory(new File(SCHEMA_DIRECTORY_NAME));

// Necessary to avoid warnings about missing user in task owner references
repoAddObjectFromFile(USER_ADMINISTRATOR_FILENAME, UserType.class, initResult);
super.initSystem(initTask, initResult);

// This should discover the connectors
LOGGER.trace("initSystem: trying modelService.postInit()");
modelService.postInit(initResult);
LOGGER.trace("initSystem: modelService.postInit() done");

PrismObject<UserType> userAdministrator = repoAddObjectFromFile(USER_ADMINISTRATOR_FILENAME, UserType.class, initResult);
loginSuperUser(userAdministrator);
}

@Test
Expand Down

0 comments on commit 3484a35

Please sign in to comment.