Skip to content

Commit

Permalink
Fix unit test ordering
Browse files Browse the repository at this point in the history
Change-Id: Ic6f5d4621b4ca9544a10ccf9f9d3542181fda5b4
  • Loading branch information
dsyer committed Feb 7, 2013
1 parent e396dd1 commit bd9957b
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Cloud Foundry 2012.02.03 Beta
* Copyright (c) [2009-2012] VMware, Inc. All Rights Reserved.
*
* This product is licensed to you under the Apache License, Version 2.0 (the "License").
* You may not use this product except in compliance with the License.
*
* This product includes a number of subcomponents with
* separate copyright notices and license terms. Your use of these
* subcomponents is subject to the terms and conditions of the
* subcomponent's license, as noted in the LICENSE file.
*/
package org.cloudfoundry.identity.uaa;

import org.cloudfoundry.identity.uaa.password.PasswordChangeEndpointTests;
import org.cloudfoundry.identity.uaa.scim.jdbc.JdbcScimUserProvisioningTests;
import org.junit.Ignore;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;

/**
* A test suite for probing weird ordering problems in the tests.
* @author Dave Syer
*
*/
@RunWith(Suite.class)
@SuiteClasses({ JdbcScimUserProvisioningTests.class, PasswordChangeEndpointTests.class })
@Ignore
public class AdhocTestSuite {

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
import org.cloudfoundry.identity.uaa.scim.validate.NullPasswordValidator;
import org.cloudfoundry.identity.uaa.security.SecurityContextAccessor;
import org.cloudfoundry.identity.uaa.test.TestUtils;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.jdbc.core.JdbcTemplate;
Expand All @@ -33,11 +35,11 @@

public class PasswordChangeEndpointTests {

private static ScimUser joel;
private ScimUser joel;

private static ScimUser dale;
private ScimUser dale;

private static PasswordChangeEndpoint endpoints;
private PasswordChangeEndpoint endpoints;

private static EmbeddedDatabase database;

Expand All @@ -46,6 +48,11 @@ public static void init() {
EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
builder.addScript("classpath:/org/cloudfoundry/identity/uaa/schema-hsqldb.sql");
database = builder.build();
}

@Before
public void setup() {

JdbcTemplate jdbcTemplate = new JdbcTemplate(database);
JdbcScimUserProvisioning dao = new JdbcScimUserProvisioning(jdbcTemplate);
dao.setPasswordEncoder(NoOpPasswordEncoder.getInstance());
Expand All @@ -63,6 +70,17 @@ public static void init() {

}

@After
public void clean() {
JdbcTemplate jdbcTemplate = new JdbcTemplate(database);
if (joel!=null) {
jdbcTemplate.update("delete from users where id=?", joel.getId());
}
if (dale!=null) {
jdbcTemplate.update("delete from users where id=?", dale.getId());
}
}

@AfterClass
public static void tearDown() throws Exception {
TestUtils.deleteFrom(database, "users", "groups", "group_membership");
Expand Down

0 comments on commit bd9957b

Please sign in to comment.