Skip to content

Commit eabc76d

Browse files
Example Test Restructuring (membrane#1631)
* restructuring (wip) * refactoring and fixes * excluded test * rm * . * add license * moved --------- Co-authored-by: Christian Gördes <goerdes@predic8.de> Co-authored-by: Christian Gördes <christian.goerdes@outlook.de> Co-authored-by: Christian Gördes <118011644+christiangoerdes@users.noreply.github.com>
1 parent 0b2e1c4 commit eabc76d

89 files changed

Lines changed: 190 additions & 368 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# any VIM swap file
1+
-# any VIM swap file
22
.*.swp
33
_*.swp
44

core/src/main/java/com/predic8/membrane/core/interceptor/adminApi/AdminApiInterceptor.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
/* Copyright 2012 predic8 GmbH, www.predic8.com
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License. */
14+
115
package com.predic8.membrane.core.interceptor.adminApi;
216

317
import com.fasterxml.jackson.core.JsonGenerator;

core/src/main/java/com/predic8/membrane/core/interceptor/schemavalidation/AbstractXMLSchemaValidator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public Outcome validateMessage(Exchange exc, Interceptor.Flow flow) throws Excep
110110
}
111111
exc.setProperty("error", errorMsg); // TODO Search for usage. If it is used rename property. See properties in class Exchange
112112
setErrorResponse(exc,flow,exceptions);
113-
msg.getHeader().add(VALIDATION_ERROR_SOURCE, flow.name());
113+
exc.getResponse().getHeader().add(VALIDATION_ERROR_SOURCE, flow.name());
114114
invalid.incrementAndGet();
115115
return ABORT;
116116
}

core/src/main/java/com/predic8/membrane/core/transport/http/ProtocolUpgradeDeniedException.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
/* Copyright 2012 predic8 GmbH, www.predic8.com
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License. */
14+
115
package com.predic8.membrane.core.transport.http;
216

317
public class ProtocolUpgradeDeniedException extends Exception {

core/src/test/java/com/predic8/membrane/core/interceptor/HTTPClientInterceptorTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
/* Copyright 2012 predic8 GmbH, www.predic8.com
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License. */
14+
115
package com.predic8.membrane.core.interceptor;
216

317
import com.predic8.membrane.core.Router;

distribution/src/test/java/com/predic8/membrane/examples/ExampleTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@
2828
ExampleTestsWithoutInternet.class
2929
})
3030
public class ExampleTests {
31+
3132
}

distribution/src/test/java/com/predic8/membrane/examples/ExampleTestsWithInternet.java

Lines changed: 3 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -14,59 +14,10 @@
1414

1515
package com.predic8.membrane.examples;
1616

17-
import com.predic8.membrane.examples.config.*;
18-
import com.predic8.membrane.examples.env.*;
19-
import com.predic8.membrane.examples.tests.*;
20-
import com.predic8.membrane.examples.tests.loadbalancing.*;
21-
import com.predic8.membrane.examples.tests.openapi.*;
22-
import com.predic8.membrane.examples.tests.rest2soap.*;
23-
import com.predic8.membrane.examples.tests.ssl.*;
24-
import com.predic8.membrane.examples.tests.validation.*;
25-
import com.predic8.membrane.examples.tests.versioning.*;
26-
import com.predic8.membrane.examples.tutorials.rest.*;
27-
import org.junit.platform.suite.api.*;
17+
import org.junit.platform.suite.api.SelectPackages;
18+
import org.junit.platform.suite.api.Suite;
2819

2920
@Suite
30-
@SelectClasses({
31-
GettingStartedExampleTest.class, // See: https://membrane-api.io/getting-started
32-
HelpLinkExistenceTest.class,
33-
34-
ACLExampleTest.class,
35-
BasicAuthExampleTest.class,
36-
FileExchangeStoreExampleTest.class,
37-
Loadbalancing4XmlSessionExampleTest.class,
38-
LoggingCSVExampleTest.class,
39-
LoggingJDBCExampleTest.class,
40-
LoggingExampleTest.class,
41-
LoginExampleTest.class,
42-
RewriterExampleTest.class,
43-
SSLServerApiWithTlsPkcs12ExampleTest.class,
44-
SSLServerApiWithTlsPemExampleTest.class,
45-
ToBackendExampleTest.class,
46-
ThrottleExampleTest.class,
47-
XSLTExampleTest.class,
48-
49-
FormValidationExampleTest.class,
50-
CustomInterceptorExampleTest.class,
51-
BasicXmlInterceptorExampleTest.class,
52-
53-
XsltExampleTest.class,
54-
55-
// OpenAPI
56-
APIProxyExampleTest.class,
57-
58-
// Tutorials
59-
TutorialRestStepsExampleTest.class,
60-
TutorialRestInitialExampleTest.class,
61-
62-
// Configuration
63-
ProxiesXMLExampleTest.class,
64-
ProxiesXMLSoapExampleTest.class,
65-
ProxiesXMLFullExampleTest.class,
66-
67-
Rest2SOAPTemplateExampleTest.class
68-
69-
})
70-
@ExcludeClassNamePatterns("com.predic8.membrane.examples.env.HelpLinkExistenceTest")
21+
@SelectPackages("com.predic8.membrane.examples.withinternet")
7122
class ExampleTestsWithInternet {
7223
}

distribution/src/test/java/com/predic8/membrane/examples/ExampleTestsWithoutInternet.java

Lines changed: 2 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -14,103 +14,10 @@
1414

1515
package com.predic8.membrane.examples;
1616

17-
import com.predic8.membrane.errorhandling.OpenAPIConfigErrorTest;
18-
import com.predic8.membrane.examples.config.ProxiesXMLOfflineExampleTest;
19-
import com.predic8.membrane.examples.config.ProxiesXMLSecurityExampleTest;
20-
import com.predic8.membrane.examples.env.ConsistentVersionNumbers;
21-
import com.predic8.membrane.examples.env.JavaLicenseInfoTest;
22-
import com.predic8.membrane.examples.tests.*;
23-
import com.predic8.membrane.examples.tests.loadbalancing.Loadbalancing1StaticExampleTest;
24-
import com.predic8.membrane.examples.tests.loadbalancing.Loadbalancing3ClientExampleTest;
25-
import com.predic8.membrane.examples.tests.loadbalancing.Loadbalancing5MultipleExampleTest;
26-
import com.predic8.membrane.examples.tests.log.AccessLogExampleTest;
27-
import com.predic8.membrane.examples.tests.message_transformation.Json2XmlExampleTest;
28-
import com.predic8.membrane.examples.tests.message_transformation.TransformationUsingJavascriptExampleTest;
29-
import com.predic8.membrane.examples.tests.message_transformation.Xml2JsonExampleTest;
30-
import com.predic8.membrane.examples.tests.oauth2.OAuth2APIExampleTest;
31-
import com.predic8.membrane.examples.tests.oauth2.OAuth2CredentialsExampleTest;
32-
import com.predic8.membrane.examples.tests.oauth2.OAuth2MembraneExampleTest;
33-
import com.predic8.membrane.examples.tests.openapi.OpenAPIRewriteExampleTest;
34-
import com.predic8.membrane.examples.tests.openapi.OpenAPIValidationSimpleExampleTest;
35-
import com.predic8.membrane.examples.tests.openapi.OpenAPIValidationExampleTest;
36-
import com.predic8.membrane.examples.tests.opentelemetry.OpenTelemetryExampleTest;
37-
import com.predic8.membrane.examples.tests.template.json.JsonTemplateExampleTest;
38-
import com.predic8.membrane.examples.tests.template.text.TextTemplateExampleTest;
39-
import com.predic8.membrane.examples.tests.template.xml.XMLTemplateExampleTest;
40-
import com.predic8.membrane.examples.tests.validation.JSONSchemaValidationExampleTest;
41-
import com.predic8.membrane.examples.tests.validation.SOAPProxyValidationExampleTest;
42-
import com.predic8.membrane.examples.tests.validation.XMLValidationExampleTest;
43-
import org.junit.platform.suite.api.SelectClasses;
17+
import org.junit.platform.suite.api.SelectPackages;
4418
import org.junit.platform.suite.api.Suite;
4519

4620
@Suite
47-
@SelectClasses({
48-
// Not examples
49-
ConsistentVersionNumbers.class,
50-
JavaLicenseInfoTest.class,
51-
OpenAPIConfigErrorTest.class,
52-
53-
// Proxy
54-
CBRXPathExampleTest.class,
55-
ProxiesXMLOfflineExampleTest.class,
56-
ProxiesXMLSecurityExampleTest.class,
57-
58-
// Scripting
59-
IfInterceptorExampleTest.class,
60-
GroovyExampleTest.class,
61-
JavascriptExampleTest.class,
62-
63-
// Load Balancing
64-
Loadbalancing1StaticExampleTest.class,
65-
Loadbalancing3ClientExampleTest.class,
66-
Loadbalancing5MultipleExampleTest.class,
67-
68-
// Validation
69-
JSONSchemaValidationExampleTest.class,
70-
XMLValidationExampleTest.class,
71-
SampleSoapServiceExampleTest.class,
72-
SOAPProxyValidationExampleTest.class,
73-
74-
// Logging
75-
AccessLogExampleTest.class,
76-
77-
// Transformation
78-
Xml2JsonExampleTest.class,
79-
Json2XmlExampleTest.class,
80-
TransformationUsingJavascriptExampleTest.class,
81-
82-
// OAuth2
83-
OAuth2APIExampleTest.class,
84-
OAuth2MembraneExampleTest.class,
85-
OAuth2CredentialsExampleTest.class,
86-
87-
// OpenAPI
88-
OpenAPIValidationSimpleExampleTest.class,
89-
OpenAPIValidationExampleTest.class,
90-
OpenTelemetryExampleTest.class,
91-
OpenAPIRewriteExampleTest.class,
92-
93-
// Template
94-
TextTemplateExampleTest.class,
95-
JsonTemplateExampleTest.class,
96-
97-
// Security
98-
JsonProtectionExampleTest.class,
99-
APIKeyExampleTest.class,
100-
APIKeyRBACExampleTest.class,
101-
APIKeyWithOpenAPIExampleTest.class,
102-
ApiKeyToJwtTest.class,
103-
104-
XMLTemplateExampleTest.class,
105-
//DefaultConfigAdminConsoleTest.class*/
106-
107-
// XML
108-
StaxInterceptorExampleTest.class,
109-
110-
// SOAP
111-
AddSoapHeaderExampleTest.class,
112-
113-
InternalProxyExampleTest.class
114-
})
21+
@SelectPackages("com.predic8.membrane.examples.withoutinternet")
11522
class ExampleTestsWithoutInternet {
11623
}

distribution/src/test/java/com/predic8/membrane/examples/ExampleUnitTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
limitations under the License. */
1414
package com.predic8.membrane.examples;
1515

16-
import com.predic8.membrane.examples.tests.integration.OAuth2ExampleTest;
16+
import com.predic8.membrane.examples.withoutinternet.integration.OAuth2ExampleTest;
1717
import org.junit.platform.suite.api.SelectClasses;
1818
import org.junit.platform.suite.api.Suite;
1919

distribution/src/test/java/com/predic8/membrane/examples/tests/ProxyExampleTest.java

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)