Skip to content

Commit 6dba4ee

Browse files
committed
Update tests to use addAsServiceProvider() instead of manually creating resource files
1 parent 1da48e7 commit 6dba4ee

18 files changed

Lines changed: 97 additions & 137 deletions

File tree

‎api-tests/src/test/java/org/ocpsoft/rewrite/config/ConfigurationCacheProviderTest.java‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
import org.apache.http.client.methods.HttpGet;
1919
import org.jboss.arquillian.container.test.api.Deployment;
20-
import org.jboss.shrinkwrap.api.asset.StringAsset;
2120
import org.jboss.shrinkwrap.api.spec.WebArchive;
2221
import org.junit.Assert;
2322
import org.junit.Test;
@@ -35,13 +34,12 @@ public class ConfigurationCacheProviderTest extends RewriteTestBase
3534
@Deployment(testable = true)
3635
public static WebArchive getDeployment()
3736
{
38-
WebArchive deployment = RewriteTestBase.getDeployment()
37+
WebArchive deployment = RewriteTestBase
38+
.getDeployment()
3939
.addPackages(true, Root.class.getPackage())
40-
.addAsResource(new StringAsset("org.ocpsoft.rewrite.config.ConfigurationCacheProviderConfig1\n" +
41-
"org.ocpsoft.rewrite.config.ConfigurationCacheProviderConfig2"),
42-
"/META-INF/services/org.ocpsoft.rewrite.config.ConfigurationProvider")
43-
.addAsResource(new StringAsset("org.ocpsoft.rewrite.config.ConfigurationCacheProviderMock"),
44-
"/META-INF/services/org.ocpsoft.rewrite.config.ConfigurationCacheProvider");
40+
.addAsServiceProvider(ConfigurationProvider.class, ConfigurationCacheProviderConfig1.class,
41+
ConfigurationCacheProviderConfig2.class)
42+
.addAsServiceProvider(ConfigurationCacheProvider.class, ConfigurationCacheProviderMock.class);
4543
return deployment;
4644
}
4745

‎api-tests/src/test/java/org/ocpsoft/rewrite/config/ConfigurationLoaderTest.java‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/*
22
* Copyright 2011 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
3-
*
3+
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
7-
*
7+
*
88
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
9+
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,7 +17,6 @@
1717

1818
import org.apache.http.client.methods.HttpGet;
1919
import org.jboss.arquillian.container.test.api.Deployment;
20-
import org.jboss.shrinkwrap.api.asset.StringAsset;
2120
import org.jboss.shrinkwrap.api.spec.WebArchive;
2221
import org.junit.Assert;
2322
import org.junit.Test;
@@ -27,7 +26,7 @@
2726

2827
/**
2928
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
30-
*
29+
*
3130
*/
3231
public class ConfigurationLoaderTest extends RewriteTestBase
3332
{
@@ -37,8 +36,7 @@ public static WebArchive getDeployment()
3736
{
3837
WebArchive deployment = RewriteTestBase.getDeployment()
3938
.addPackages(true, Root.class.getPackage())
40-
.addAsResource(new StringAsset("org.ocpsoft.rewrite.config.NullValueConfigurationProvider"),
41-
"/META-INF/services/org.ocpsoft.rewrite.config.ConfigurationProvider");
39+
.addAsServiceProvider(ConfigurationProvider.class, NullValueConfigurationProvider.class);
4240
return deployment;
4341
}
4442

‎api-tests/src/test/java/org/ocpsoft/rewrite/config/RelocatingConfigurationLoaderTest.java‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/*
22
* Copyright 2011 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
3-
*
3+
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
7-
*
7+
*
88
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
9+
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,7 +17,6 @@
1717

1818
import org.apache.http.client.methods.HttpGet;
1919
import org.jboss.arquillian.container.test.api.Deployment;
20-
import org.jboss.shrinkwrap.api.asset.StringAsset;
2120
import org.jboss.shrinkwrap.api.spec.WebArchive;
2221
import org.junit.Assert;
2322
import org.junit.Test;
@@ -27,20 +26,20 @@
2726

2827
/**
2928
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
30-
*
29+
*
3130
*/
3231
public class RelocatingConfigurationLoaderTest extends RewriteTestBase
3332
{
3433

3534
@Deployment(testable = true)
3635
public static WebArchive getDeployment()
3736
{
38-
WebArchive deployment = RewriteTestBase.getDeployment()
37+
WebArchive deployment = RewriteTestBase
38+
.getDeployment()
3939
.addPackages(true, Root.class.getPackage())
40-
.addAsResource(new StringAsset("org.ocpsoft.rewrite.config.RelocatingConfigurationProvider1\n" +
41-
"org.ocpsoft.rewrite.config.RelocatingConfigurationProvider2\n" +
42-
"org.ocpsoft.rewrite.config.RelocatingConfigurationProvider3"),
43-
"/META-INF/services/org.ocpsoft.rewrite.config.ConfigurationProvider");
40+
.addAsServiceProvider(ConfigurationProvider.class,
41+
RelocatingConfigurationProvider1.class, RelocatingConfigurationProvider2.class,
42+
RelocatingConfigurationProvider3.class);
4443
return deployment;
4544
}
4645

‎api-tests/src/test/java/org/ocpsoft/rewrite/config/RewriteFilterInvalidProviderTest.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717

1818
import org.apache.http.client.methods.HttpGet;
1919
import org.jboss.arquillian.container.test.api.Deployment;
20-
import org.jboss.shrinkwrap.api.asset.StringAsset;
2120
import org.jboss.shrinkwrap.api.spec.WebArchive;
2221
import org.junit.Assert;
2322
import org.junit.Test;
2423
import org.ocpsoft.rewrite.Root;
24+
import org.ocpsoft.rewrite.spi.RewriteProvider;
2525
import org.ocpsoft.rewrite.test.HttpAction;
2626
import org.ocpsoft.rewrite.test.RewriteTestBase;
2727

@@ -37,8 +37,8 @@ public static WebArchive getDeployment()
3737
{
3838
WebArchive deployment = RewriteTestBase.getDeployment()
3939
.addPackages(true, Root.class.getPackage())
40-
.addAsResource(new StringAsset("org.ocpsoft.rewrite.config.RewriteFilterInvalidRewriteProvider"),
41-
"/META-INF/services/org.ocpsoft.rewrite.spi.RewriteProvider");
40+
.addAsServiceProvider(RewriteProvider.class,
41+
RewriteFilterInvalidRewriteProvider.class);
4242
return deployment;
4343
}
4444

‎impl-servlet/src/test/java/org/ocpsoft/rewrite/servlet/config/EncodeQueryConfigurationTest.java‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/*
22
* Copyright 2011 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
3-
*
3+
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
7-
*
7+
*
88
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
9+
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,10 +20,10 @@
2020
import org.apache.http.client.methods.HttpGet;
2121
import org.jboss.arquillian.container.test.api.Deployment;
2222
import org.jboss.arquillian.junit.Arquillian;
23-
import org.jboss.shrinkwrap.api.asset.StringAsset;
2423
import org.jboss.shrinkwrap.api.spec.WebArchive;
2524
import org.junit.Test;
2625
import org.junit.runner.RunWith;
26+
import org.ocpsoft.rewrite.config.ConfigurationProvider;
2727
import org.ocpsoft.rewrite.servlet.ServletRoot;
2828
import org.ocpsoft.rewrite.test.HttpAction;
2929
import org.ocpsoft.rewrite.test.RewriteTestBase;
@@ -40,10 +40,7 @@ public static WebArchive getDeployment()
4040
WebArchive deployment = RewriteTestBase
4141
.getDeployment()
4242
.addPackages(true, ServletRoot.class.getPackage())
43-
.addAsResource(
44-
new StringAsset(
45-
"org.ocpsoft.rewrite.servlet.config.EncodeQueryConfigurationProvider"),
46-
"/META-INF/services/org.ocpsoft.rewrite.config.ConfigurationProvider");
43+
.addAsServiceProvider(ConfigurationProvider.class, EncodeQueryConfigurationProvider.class);
4744
return deployment;
4845
}
4946

‎impl-servlet/src/test/java/org/ocpsoft/rewrite/servlet/config/HttpConfigurationOrderTest.java‎

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/*
22
* Copyright 2011 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
3-
*
3+
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
7-
*
7+
*
88
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
9+
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,10 +20,10 @@
2020
import org.apache.http.client.methods.HttpGet;
2121
import org.jboss.arquillian.container.test.api.Deployment;
2222
import org.jboss.arquillian.junit.Arquillian;
23-
import org.jboss.shrinkwrap.api.asset.StringAsset;
2423
import org.jboss.shrinkwrap.api.spec.WebArchive;
2524
import org.junit.Test;
2625
import org.junit.runner.RunWith;
26+
import org.ocpsoft.rewrite.config.ConfigurationProvider;
2727
import org.ocpsoft.rewrite.servlet.ServletRoot;
2828
import org.ocpsoft.rewrite.test.HttpAction;
2929
import org.ocpsoft.rewrite.test.RewriteTestBase;
@@ -40,12 +40,8 @@ public static WebArchive getDeployment()
4040
WebArchive deployment = RewriteTestBase
4141
.getDeployment()
4242
.addPackages(true, ServletRoot.class.getPackage())
43-
.addAsResource(
44-
new StringAsset(
45-
"org.ocpsoft.rewrite.servlet.config.HttpConfigurationTestProvider" +
46-
"\n" +
47-
"org.ocpsoft.rewrite.servlet.config.HttpConfigurationTestProviderTwo"),
48-
"/META-INF/services/org.ocpsoft.rewrite.config.ConfigurationProvider");
43+
.addAsServiceProvider(ConfigurationProvider.class, HttpConfigurationTestProvider.class,
44+
HttpConfigurationTestProviderTwo.class);
4945

5046
return deployment;
5147
}

‎impl-servlet/src/test/java/org/ocpsoft/rewrite/servlet/config/HttpConfigurationTest.java‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/*
22
* Copyright 2011 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
3-
*
3+
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
7-
*
7+
*
88
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
9+
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,10 +20,10 @@
2020
import org.apache.http.client.methods.HttpGet;
2121
import org.jboss.arquillian.container.test.api.Deployment;
2222
import org.jboss.arquillian.junit.Arquillian;
23-
import org.jboss.shrinkwrap.api.asset.StringAsset;
2423
import org.jboss.shrinkwrap.api.spec.WebArchive;
2524
import org.junit.Test;
2625
import org.junit.runner.RunWith;
26+
import org.ocpsoft.rewrite.config.ConfigurationProvider;
2727
import org.ocpsoft.rewrite.servlet.ServletRoot;
2828
import org.ocpsoft.rewrite.test.HttpAction;
2929
import org.ocpsoft.rewrite.test.RewriteTestBase;
@@ -39,8 +39,7 @@ public static WebArchive getDeployment()
3939
{
4040
WebArchive deployment = RewriteTestBase.getDeployment()
4141
.addPackages(true, ServletRoot.class.getPackage())
42-
.addAsResource(new StringAsset("org.ocpsoft.rewrite.servlet.config.HttpConfigurationTestProvider"),
43-
"/META-INF/services/org.ocpsoft.rewrite.config.ConfigurationProvider");
42+
.addAsServiceProvider(ConfigurationProvider.class, HttpConfigurationTestProvider.class);
4443
return deployment;
4544
}
4645

‎impl-servlet/src/test/java/org/ocpsoft/rewrite/servlet/config/JoinConfigurationTest.java‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/*
22
* Copyright 2011 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
3-
*
3+
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
7-
*
7+
*
88
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
9+
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,10 +20,10 @@
2020
import org.apache.http.client.methods.HttpGet;
2121
import org.jboss.arquillian.container.test.api.Deployment;
2222
import org.jboss.arquillian.junit.Arquillian;
23-
import org.jboss.shrinkwrap.api.asset.StringAsset;
2423
import org.jboss.shrinkwrap.api.spec.WebArchive;
2524
import org.junit.Test;
2625
import org.junit.runner.RunWith;
26+
import org.ocpsoft.rewrite.config.ConfigurationProvider;
2727
import org.ocpsoft.rewrite.servlet.ServletRoot;
2828
import org.ocpsoft.rewrite.test.HttpAction;
2929
import org.ocpsoft.rewrite.test.RewriteTestBase;
@@ -40,10 +40,7 @@ public static WebArchive getDeployment()
4040
WebArchive deployment = RewriteTestBase
4141
.getDeployment()
4242
.addPackages(true, ServletRoot.class.getPackage())
43-
.addAsResource(
44-
new StringAsset(
45-
"org.ocpsoft.rewrite.servlet.config.JoinConfigurationProvider"),
46-
"/META-INF/services/org.ocpsoft.rewrite.config.ConfigurationProvider");
43+
.addAsServiceProvider(ConfigurationProvider.class, JoinConfigurationProvider.class);
4744
return deployment;
4845
}
4946

‎impl-servlet/src/test/java/org/ocpsoft/rewrite/servlet/config/LifecycleControlTest.java‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/*
22
* Copyright 2011 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
3-
*
3+
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
7-
*
7+
*
88
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
9+
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,10 +20,10 @@
2020
import org.apache.http.client.methods.HttpGet;
2121
import org.jboss.arquillian.container.test.api.Deployment;
2222
import org.jboss.arquillian.junit.Arquillian;
23-
import org.jboss.shrinkwrap.api.asset.StringAsset;
2423
import org.jboss.shrinkwrap.api.spec.WebArchive;
2524
import org.junit.Test;
2625
import org.junit.runner.RunWith;
26+
import org.ocpsoft.rewrite.config.ConfigurationProvider;
2727
import org.ocpsoft.rewrite.servlet.ServletRoot;
2828
import org.ocpsoft.rewrite.test.HttpAction;
2929
import org.ocpsoft.rewrite.test.RewriteTestBase;
@@ -40,10 +40,7 @@ public static WebArchive getDeployment()
4040
WebArchive deployment = RewriteTestBase
4141
.getDeployment()
4242
.addPackages(true, ServletRoot.class.getPackage())
43-
.addAsResource(
44-
new StringAsset(
45-
"org.ocpsoft.rewrite.servlet.config.LifecycleControlConfigurationProvider"),
46-
"/META-INF/services/org.ocpsoft.rewrite.config.ConfigurationProvider");
43+
.addAsServiceProvider(ConfigurationProvider.class, LifecycleControlConfigurationProvider.class);
4744
return deployment;
4845
}
4946

‎impl-servlet/src/test/java/org/ocpsoft/rewrite/servlet/config/ParameterConfigurationTest.java‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/*
22
* Copyright 2011 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
3-
*
3+
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
7-
*
7+
*
88
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
9+
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,10 +20,10 @@
2020
import org.apache.http.client.methods.HttpGet;
2121
import org.jboss.arquillian.container.test.api.Deployment;
2222
import org.jboss.arquillian.junit.Arquillian;
23-
import org.jboss.shrinkwrap.api.asset.StringAsset;
2423
import org.jboss.shrinkwrap.api.spec.WebArchive;
2524
import org.junit.Test;
2625
import org.junit.runner.RunWith;
26+
import org.ocpsoft.rewrite.config.ConfigurationProvider;
2727
import org.ocpsoft.rewrite.servlet.ServletRoot;
2828
import org.ocpsoft.rewrite.test.HttpAction;
2929
import org.ocpsoft.rewrite.test.RewriteTestBase;
@@ -40,10 +40,7 @@ public static WebArchive getDeployment()
4040
WebArchive deployment = RewriteTestBase
4141
.getDeployment()
4242
.addPackages(true, ServletRoot.class.getPackage())
43-
.addAsResource(
44-
new StringAsset(
45-
"org.ocpsoft.rewrite.servlet.config.ParameterConfigurationProvider"),
46-
"/META-INF/services/org.ocpsoft.rewrite.config.ConfigurationProvider");
43+
.addAsServiceProvider(ConfigurationProvider.class, ParameterConfigurationProvider.class);
4744
return deployment;
4845
}
4946

0 commit comments

Comments
 (0)