-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JSONB appclient tests running with glassfish (#1564)
* jsonb appclient tests running with glassfish * fix 4 pluggability appclient tests that uses jsonb_alternate_provider jar
- Loading branch information
1 parent
9db8649
commit 1d3acfb
Showing
14 changed files
with
2,993 additions
and
138 deletions.
There are no files selected for viewing
Binary file added
BIN
+2.2 KB
glassfish-runner/jsonb-platform-tck/jakartaeetck/bin/certificates/clientcert.jks
Binary file not shown.
Binary file added
BIN
+1.58 KB
glassfish-runner/jsonb-platform-tck/jakartaeetck/bin/certificates/clientcert.p12
Binary file not shown.
Binary file added
BIN
+909 Bytes
glassfish-runner/jsonb-platform-tck/jakartaeetck/bin/certificates/cts_cert
Binary file not shown.
2,463 changes: 2,463 additions & 0 deletions
2,463
glassfish-runner/jsonb-platform-tck/jakartaeetck/bin/ts.jte
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
.../jsonb-platform-tck/src/main/java/org/glassfish/jsonb/tck/GlassfishLoadableExtension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright (c) 2024 Oracle and/or its affiliates. All rights reserved. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0, which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the | ||
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License, | ||
* version 2 with the GNU Classpath Exception, which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
*/ | ||
|
||
package org.glassfish.jsonb.tck; | ||
|
||
import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArchiveProcessor; | ||
import org.jboss.arquillian.test.spi.enricher.resource.ResourceProvider; | ||
import org.jboss.arquillian.core.spi.LoadableExtension; | ||
|
||
public class GlassfishLoadableExtension implements LoadableExtension { | ||
@Override | ||
public void register(ExtensionBuilder extensionBuilder) { | ||
extensionBuilder.service(ResourceProvider.class, GlassfishTestArchiveProcessor.class); | ||
extensionBuilder.observer(GlassfishTestArchiveProcessor.class); | ||
|
||
} | ||
} |
149 changes: 149 additions & 0 deletions
149
...onb-platform-tck/src/main/java/org/glassfish/jsonb/tck/GlassfishTestArchiveProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
/* | ||
* Copyright (c) 2024 Oracle and/or its affiliates. All rights reserved. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0, which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the | ||
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License, | ||
* version 2 with the GNU Classpath Exception, which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
*/ | ||
|
||
package org.glassfish.jsonb.tck; | ||
|
||
import org.jboss.arquillian.config.descriptor.api.ArquillianDescriptor; | ||
import org.jboss.arquillian.config.descriptor.api.ExtensionDef; | ||
import org.jboss.arquillian.core.api.annotation.Observes; | ||
import org.jboss.shrinkwrap.api.Archive; | ||
import org.jboss.shrinkwrap.api.container.ManifestContainer; | ||
import org.jboss.shrinkwrap.api.spec.EnterpriseArchive; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.jboss.shrinkwrap.api.spec.WebArchive; | ||
import tck.arquillian.porting.lib.spi.AbstractTestArchiveProcessor; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.net.URL; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
import java.util.Collections; | ||
import java.util.HashSet; | ||
import java.util.List; | ||
import java.util.logging.Logger; | ||
|
||
public class GlassfishTestArchiveProcessor extends AbstractTestArchiveProcessor { | ||
|
||
static Logger log = Logger.getLogger(GlassfishTestArchiveProcessor.class.getName()); | ||
static HashSet<String> sunXmlFiles = new HashSet<String>(); | ||
static { | ||
sunXmlFiles.add("META-INF/sun-application-client.xml"); | ||
sunXmlFiles.add("META-INF/sun-application.xml"); | ||
sunXmlFiles.add("META-INF/sun-ra.xml"); | ||
sunXmlFiles.add("WEB-INF/sun-web.xml"); | ||
sunXmlFiles.add("META-INF/sun-ejb-jar.xml"); | ||
} | ||
|
||
private Path descriptorDirRoot; | ||
|
||
/** | ||
* Called on completion of the Arquillian configuration. | ||
*/ | ||
public void initalize(@Observes ArquillianDescriptor descriptor) { | ||
// Must call to setup the ResourceProvider | ||
super.initalize(descriptor); | ||
|
||
|
||
// Get the descriptor path | ||
ExtensionDef descriptorsDef = descriptor.extension("glassfish-descriptors"); | ||
String descriptorDir = descriptorsDef.getExtensionProperties().get("descriptorDir"); | ||
if(descriptorDir == null) { | ||
String msg = "Specify the descriptorDir property in arquillian.xml as extension:\n"+ | ||
"<extension qualifier=\"glassfish-descriptors\">\n" + | ||
" <property name=\"descriptorDir\">path-to-descriptors-dir</property>\n" + | ||
"</extension>"; | ||
throw new IllegalStateException(msg); | ||
} | ||
this.descriptorDirRoot = Paths.get(descriptorDir); | ||
if(!Files.exists(this.descriptorDirRoot)) { | ||
throw new RuntimeException("Descriptor directory does not exist: " + this.descriptorDirRoot); | ||
} | ||
} | ||
|
||
@Override | ||
public void processClientArchive(JavaArchive clientArchive, Class<?> testClass, URL sunXmlURL) { | ||
String name = clientArchive.getName(); | ||
// addDescriptors(name, clientArchive, testClass); | ||
} | ||
|
||
@Override | ||
public void processWebArchive(WebArchive webArchive, Class<?> testClass, URL sunXmlURL) { | ||
String name = webArchive.getName(); | ||
// addDescriptors(name, webArchive, testClass); | ||
} | ||
|
||
@Override | ||
public void processRarArchive(JavaArchive warArchive, Class<?> testClass, URL sunXmlURL) { | ||
|
||
} | ||
|
||
@Override | ||
public void processParArchive(JavaArchive javaArchive, Class<?> aClass, URL url) { | ||
|
||
} | ||
|
||
@Override | ||
public void processEarArchive(EnterpriseArchive earArchive, Class<?> testClass, URL sunXmlURL) { | ||
String name = earArchive.getName(); | ||
// addDescriptors(name, earArchive, testClass); | ||
} | ||
|
||
@Override | ||
public void processEjbArchive(JavaArchive ejbArchive, Class<?> testClass, URL sunXmlURL) { | ||
String name = ejbArchive.getName(); | ||
// addDescriptors(name, ejbArchive, testClass); | ||
} | ||
|
||
protected void addDescriptors(String archiveName, ManifestContainer<?> archive, Class<?> testClass) { | ||
String pkgName = testClass.getPackageName(); | ||
Path pkgPath = Paths.get(pkgName.replace(".", "/")); | ||
Path descriptorDir = descriptorDirRoot.resolve(pkgPath); | ||
List<File> files = findGlassfishDescriptors(descriptorDir); | ||
for (File f : files) { | ||
String name = f.getName(); | ||
if(!name.startsWith(archiveName)) { | ||
continue; | ||
} | ||
try { | ||
URL url = f.toURL(); | ||
// stateful_migration_threetwo_annotated.ear.jboss-deployment-structure.xml -> jboss-deployment-structure.xml | ||
String descriptorName = name.replace(archiveName+".", ""); | ||
if(archive instanceof WebArchive webArchive) { | ||
webArchive.addAsWebInfResource(url, descriptorName); | ||
} else { | ||
archive.addAsManifestResource(url, descriptorName); | ||
} | ||
} catch (IOException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
} | ||
|
||
protected List<File> findGlassfishDescriptors(Path pkgPath) { | ||
try { | ||
List<File> files = Files.walk(pkgPath, 1) | ||
.map(Path::toFile) | ||
.filter(File::isFile) | ||
.toList(); | ||
return files; | ||
} catch (Exception e) { | ||
} | ||
return Collections.emptyList(); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...-tck/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
org.glassfish.jsonb.tck.GlassfishLoadableExtension |
Oops, something went wrong.