Broadly remove deprecated core classes and methods

Issue: SPR-14430
This commit is contained in:
Juergen Hoeller
2016-07-05 15:52:48 +02:00
parent 0fc0ce78ae
commit b5db5d3aac
119 changed files with 145 additions and 6086 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -45,8 +45,8 @@ public class AnnotationConfigWebContextLoaderTests {
AnnotationConfigWebContextLoader loader = new AnnotationConfigWebContextLoader();
WebMergedContextConfiguration mergedConfig = new WebMergedContextConfiguration(getClass(),
new String[] { "config.xml" }, EMPTY_CLASS_ARRAY, null, EMPTY_STRING_ARRAY, "resource/path", loader, null,
null);
new String[] { "config.xml" }, EMPTY_CLASS_ARRAY, null, EMPTY_STRING_ARRAY, EMPTY_STRING_ARRAY,
EMPTY_STRING_ARRAY, "resource/path", loader, null, null);
loader.loadContext(mergedConfig);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,14 +37,14 @@ public class GenericXmlWebContextLoaderTests {
@Test
@SuppressWarnings("deprecation")
public void configMustNotContainAnnotatedClasses() throws Exception {
expectedException.expect(IllegalStateException.class);
expectedException.expectMessage(containsString("does not support annotated classes"));
GenericXmlWebContextLoader loader = new GenericXmlWebContextLoader();
WebMergedContextConfiguration mergedConfig = new WebMergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY,
new Class<?>[] { getClass() }, null, EMPTY_STRING_ARRAY, "resource/path", loader, null, null);
new Class<?>[] { getClass() }, null, EMPTY_STRING_ARRAY, EMPTY_STRING_ARRAY, EMPTY_STRING_ARRAY,
"resource/path", loader, null, null);
loader.loadContext(mergedConfig);
}

View File

@@ -1,64 +0,0 @@
/*
* Copyright 2002-2014 the original author or authors.
*
* 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 org.springframework.test.jdbc;
import java.util.Arrays;
import org.junit.After;
import org.junit.Test;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.EncodedResource;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
import static org.junit.Assert.*;
/**
* Integration tests for {@link JdbcTestUtils}.
*
* @author Sam Brannen
* @since 4.0.3
* @see JdbcTestUtilsTests
*/
public class JdbcTestUtilsIntegrationTests {
private final EmbeddedDatabase db = new EmbeddedDatabaseBuilder().build();
private JdbcTemplate jdbcTemplate = new JdbcTemplate(db);
@After
public void shutdown() {
db.shutdown();
}
@Test
@SuppressWarnings("deprecation")
public void executeSqlScriptsAndcountRowsInTableWhere() throws Exception {
for (String script : Arrays.asList("schema.sql", "data.sql")) {
Resource resource = new ClassPathResource(script, getClass());
JdbcTestUtils.executeSqlScript(this.jdbcTemplate, new EncodedResource(resource), false);
}
assertEquals(1, JdbcTestUtils.countRowsInTableWhere(jdbcTemplate, "person", "name = 'bob'"));
}
}

View File

@@ -35,7 +35,6 @@ import static org.junit.Assert.*;
* @author Rob Winch
* @since 4.2
*/
@SuppressWarnings("deprecation")
public class MockMvcWebConnectionTests {
private final WebClient webClient = new WebClient();
@@ -50,7 +49,7 @@ public class MockMvcWebConnectionTests {
@Test
public void contextPathNull() throws IOException {
this.webClient.setWebConnection(new MockMvcWebConnection(this.mockMvc, (String) null));
this.webClient.setWebConnection(new MockMvcWebConnection(this.mockMvc, this.webClient));
Page page = this.webClient.getPage("http://localhost/context/a");
@@ -59,7 +58,7 @@ public class MockMvcWebConnectionTests {
@Test
public void contextPathExplicit() throws IOException {
this.webClient.setWebConnection(new MockMvcWebConnection(this.mockMvc, "/context"));
this.webClient.setWebConnection(new MockMvcWebConnection(this.mockMvc, this.webClient, "/context"));
Page page = this.webClient.getPage("http://localhost/context/a");
@@ -68,7 +67,7 @@ public class MockMvcWebConnectionTests {
@Test
public void contextPathEmpty() throws IOException {
this.webClient.setWebConnection(new MockMvcWebConnection(this.mockMvc, ""));
this.webClient.setWebConnection(new MockMvcWebConnection(this.mockMvc, this.webClient, ""));
Page page = this.webClient.getPage("http://localhost/context/a");
@@ -77,7 +76,7 @@ public class MockMvcWebConnectionTests {
@Test
public void forward() throws IOException {
this.webClient.setWebConnection(new MockMvcWebConnection(this.mockMvc, ""));
this.webClient.setWebConnection(new MockMvcWebConnection(this.mockMvc, this.webClient, ""));
Page page = this.webClient.getPage("http://localhost/forward");
@@ -87,13 +86,13 @@ public class MockMvcWebConnectionTests {
@Test(expected = IllegalArgumentException.class)
@SuppressWarnings("resource")
public void contextPathDoesNotStartWithSlash() throws IOException {
new MockMvcWebConnection(this.mockMvc, "context");
new MockMvcWebConnection(this.mockMvc, this.webClient, "context");
}
@Test(expected = IllegalArgumentException.class)
@SuppressWarnings("resource")
public void contextPathEndsWithSlash() throws IOException {
new MockMvcWebConnection(this.mockMvc, "/context/");
new MockMvcWebConnection(this.mockMvc, this.webClient, "/context/");
}
}