/
DuplicateDeploymentTest.java
60 lines (50 loc) · 2.16 KB
/
DuplicateDeploymentTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package org.jboss.resteasy.test.core.basic;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.resteasy.category.NotForForwardCompatibility;
import org.jboss.resteasy.test.core.basic.resource.DuplicateDeploymentReader;
import org.jboss.resteasy.test.core.basic.resource.DuplicateDeploymentResource;
import org.jboss.resteasy.utils.TestUtil;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Assert;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import static org.jboss.resteasy.test.ContainerConstants.DEFAULT_CONTAINER_QUALIFIER;
/**
* @tpSubChapter Response
* @tpChapter Integration tests
* @tpSince RESTEasy 3.0.17
* @tpTestCaseDetails Regression test for JBEAP-4697
*/
@RunWith(Arquillian.class)
@RunAsClient
public class DuplicateDeploymentTest {
private static int initWarningCount = 0;
private static int getWarningCount() {
return TestUtil.getWarningCount("RESTEASY002172", false, DEFAULT_CONTAINER_QUALIFIER);
}
@Deployment
public static Archive<?> deploy() {
initWarningCount = getWarningCount();
WebArchive war = TestUtil.prepareArchive(DuplicateDeploymentTest.class.getSimpleName());
List<Class<?>> singletons = new ArrayList<>();
singletons.add(DuplicateDeploymentResource.class);
singletons.add(DuplicateDeploymentReader.class);
return TestUtil.finishContainerPrepare(war, null, singletons, DuplicateDeploymentResource.class, DuplicateDeploymentReader.class);
}
/**
* @tpTestDetails Check number of warning messages: Singleton resource object class "Resource" already deployed. Singleton ignored.
* @tpSince RESTEasy 3.0.17
*/
@Test
@Category({NotForForwardCompatibility.class})
public void testDeploy() throws IOException {
Assert.assertEquals("Wrong count of warning messages in logs", 2, getWarningCount() - initWarningCount);
}
}