-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes EnterpriseBeanLifecycleTest - using GF (de)serialization
- BeanImpl in Weld doesn't care about IndirectlySerializable classes, so this impl cares - it wasn't possible to override just some methods of the weld-porting-package-tck implementation, Weld then started complaining we have two implementations because it loaded both property files (?) - GlassFishContextImpl and GlassFishELImpl are copy-pasted from weld-porting-package-tck for now, but it is probable they will change soon too. Signed-off-by: David Matějček <dmatej@seznam.cz>
- Loading branch information
Showing
5 changed files
with
305 additions
and
87 deletions.
There are no files selected for viewing
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
50 changes: 50 additions & 0 deletions
50
appserver/tests/tck/cdi/src/test/java/org/jboss/weld/tck/glassfish/GlassFishBeansImpl.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,50 @@ | ||
/* | ||
* Copyright (c) 2022 Eclipse Foundation 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.jboss.weld.tck.glassfish; | ||
|
||
import com.sun.enterprise.container.common.impl.util.JavaEEIOUtilsImpl; | ||
|
||
import java.io.IOException; | ||
|
||
import org.jboss.cdi.tck.spi.Beans; | ||
|
||
/** | ||
* @author David Matejcek | ||
*/ | ||
public class GlassFishBeansImpl implements Beans { | ||
|
||
@Override | ||
public boolean isProxy(Object instance) { | ||
return instance.getClass().getName().indexOf("_$$_Weld") > 0; | ||
} | ||
|
||
@Override | ||
public byte[] passivate(Object instance) throws IOException { | ||
JavaEEIOUtilsImpl utils = new JavaEEIOUtilsImpl(); | ||
return utils.serializeObject(instance, true); | ||
} | ||
|
||
@Override | ||
public Object activate(byte[] bytes) throws IOException, ClassNotFoundException { | ||
JavaEEIOUtilsImpl utils = new JavaEEIOUtilsImpl(); | ||
try { | ||
return utils.deserializeObject(bytes, true, Thread.currentThread().getContextClassLoader()); | ||
} catch (Exception e) { | ||
throw new IllegalStateException("Could not deserialize the object.", e); | ||
} | ||
} | ||
} |
Oops, something went wrong.