35
35
import java .net .URLDecoder ;
36
36
37
37
import org .camunda .bpm .container .impl .tomcat .deployment .TomcatParseBpmPlatformXmlStep ;
38
- import org .junit .Rule ;
38
+ import org .junit .After ;
39
+ import org .junit .Before ;
39
40
import org .junit .Test ;
40
- import org .springframework .mock .jndi .SimpleNamingContext ;
41
41
42
42
/**
43
43
* Checks the correct retrieval of bpm-platform.xml file through JNDI,
@@ -63,8 +63,19 @@ public class BpmPlatformXmlLocationTest {
63
63
private static final String BPM_PLATFORM_XML_LOCATION_URL_HTTP_PROTOCOL = "http://localhost:8080/camunda/" + BPM_PLATFORM_XML_FILE ;
64
64
private static final String BPM_PLATFORM_XML_LOCATION_URL_HTTPS_PROTOCOL = "https://localhost:8080/camunda/" + BPM_PLATFORM_XML_FILE ;
65
65
66
- @ Rule
67
- public MockInitialContextRule initialContextRule = new MockInitialContextRule (new SimpleNamingContext ());
66
+ protected Context context ;
67
+
68
+ @ Before
69
+ public void setUp () throws NamingException {
70
+ context = new InitialContext ();
71
+ }
72
+
73
+ @ After
74
+ public void close () throws NamingException {
75
+ if (context != null ) {
76
+ context .close ();
77
+ }
78
+ }
68
79
69
80
@ Test
70
81
public void checkValidBpmPlatformXmlResourceLocationForUrl () throws NamingException , MalformedURLException {
@@ -121,7 +132,6 @@ public void checkValidBpmPlatformXmlResourceLocation() throws NamingException, M
121
132
122
133
@ Test
123
134
public void getBpmPlatformXmlLocationFromJndi () throws NamingException , MalformedURLException {
124
- Context context = new InitialContext ();
125
135
context .bind ("java:comp/env/" + BPM_PLATFORM_XML_LOCATION , BPM_PLATFORM_XML_FILE_ABSOLUTE_LOCATION );
126
136
127
137
URL url = new TomcatParseBpmPlatformXmlStep ().lookupBpmPlatformXmlLocationFromJndi ();
@@ -184,7 +194,6 @@ public void getBpmPlatformXmlFromCatalinaConfDirectory() throws MalformedURLExce
184
194
185
195
@ Test
186
196
public void lookupBpmPlatformXml () throws NamingException , MalformedURLException {
187
- Context context = new InitialContext ();
188
197
context .bind ("java:comp/env/" + BPM_PLATFORM_XML_LOCATION , BPM_PLATFORM_XML_FILE_ABSOLUTE_LOCATION );
189
198
190
199
URL url = new TomcatParseBpmPlatformXmlStep ().lookupBpmPlatformXml ();
0 commit comments