Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync 6.x to master220412 + Fixed OSGI Shell #23901

Merged
merged 67 commits into from
Apr 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
5ced771
Issue #23507 nucleus-tests rebased to glassfish.zip and enabled
dmatej Mar 26, 2022
57a66d9
Issue #23507 nucleus-tests moved to appserver admin tests
dmatej Mar 30, 2022
e302871
Integrate Jersey 3.0.4
hs536 Apr 3, 2022
3480a7c
Resolve conflicts
hs536 Apr 3, 2022
f7901c4
#23507 Fixed admin-tests
dmatej Apr 3, 2022
87243bd
Replacing broken ra.xml - the one in openmq 6.2.0 is invalid
dmatej Apr 3, 2022
d2d04c4
Fixed Pattern constraint validator messages
dmatej Apr 3, 2022
4090e1e
Optimization in GetHabitatInfo command
dmatej Apr 3, 2022
e08d842
Fixed error processing around JMS Destination admin commands
dmatej Apr 3, 2022
dbae2da
Fixed saving of temporary files (uploaded when deploying)
dmatej Apr 3, 2022
8c29a78
Random cleanups
dmatej Apr 3, 2022
00492b4
Merge pull request #23886 from hs536/jersey304
arjantijms Apr 3, 2022
c95fa71
Refactoring in admin-tests
dmatej Apr 4, 2022
86ae3a9
ClientWrapper is Closeable now
dmatej Apr 4, 2022
5662e66
Renamed package to org.glassfish.main.admin.test.rest
dmatej Apr 4, 2022
2be7140
Merge pull request #23889 from dmatej/nucleus-tests-6.x
arjantijms Apr 4, 2022
698fff0
#23507 Forgotten junit4 usage in forgotten module -> junit5
dmatej Apr 6, 2022
7415633
Tiny updates
dmatej Apr 6, 2022
0c34473
Updated maven plugins
dmatej Apr 6, 2022
cac3629
Take care about white space
dmatej Apr 6, 2022
8248152
Remove empty volumeMounts
hs536 Mar 2, 2022
23ca958
Updated HK2 from 3.0.2 to 3.0.3
dmatej Apr 6, 2022
aa384a1
#23507 Removed usage of deprecated methods in tests
dmatej Mar 5, 2022
939774f
Fixes 16587 - support custom principal in Jakarta Authentication
arjantijms Mar 28, 2022
259f5cf
Updated checkstyle dependency
dmatej Apr 6, 2022
50b8628
Removed removed parameter
arjantijms Apr 2, 2022
ee32672
Fixed compatibility of OpenDJ with JDK17
dmatej Apr 4, 2022
7541f0a
Cleanup cherrypick to 6.x
dmatej Apr 6, 2022
ff4c62b
Fixed imports of RequestFacade
dmatej Apr 6, 2022
d50705a
TCK cleanup
dmatej Apr 6, 2022
a68cc4b
Stabilized admin-tests
dmatej Apr 8, 2022
8fa08c2
Merge pull request #23893 from dmatej/sync-to-6.x
arjantijms Apr 9, 2022
bc4e02a
mvn package should pass after mvn clean install -Pfastest -T4C too
dmatej Apr 11, 2022
b30e3f6
Updated >project< artifact to 1.0.7
dmatej Apr 11, 2022
74adc51
RestModelExtensionProcessor class cleanup
dmatej Apr 11, 2022
2282b1e
Fixed build_re_dev used on Eclipse's Jenkins
dmatej Apr 11, 2022
f429eb6
Fixed mistake committed after recent experiments
dmatej Apr 11, 2022
d56ff92
Merge pull request #23899 from dmatej/mvn-annotation-processing
arjantijms Apr 11, 2022
9609096
Issue #23507 nucleus-tests rebased to glassfish.zip and enabled
dmatej Mar 26, 2022
72b6570
Issue #23507 nucleus-tests moved to appserver admin tests
dmatej Apr 12, 2022
eb3c95f
#23507 Fixed admin-tests
dmatej Apr 3, 2022
9638736
Fixed Pattern constraint validator messages
dmatej Apr 3, 2022
9ef6663
Optimization in GetHabitatInfo command
dmatej Apr 3, 2022
812bc8d
Fixed error processing around JMS Destination admin commands
dmatej Apr 3, 2022
8262ac4
Fixed saving of temporary files (uploaded when deploying)
dmatej Apr 3, 2022
1407e96
Random cleanups
dmatej Apr 3, 2022
2c3af69
Refactoring in admin-tests
dmatej Apr 4, 2022
be9368b
ClientWrapper is Closeable now
dmatej Apr 4, 2022
e3f2e2f
Renamed package to org.glassfish.main.admin.test.rest
dmatej Apr 4, 2022
e99fcbf
#23507 Forgotten junit4 usage in forgotten module -> junit5
dmatej Apr 6, 2022
edfa046
Tiny updates
dmatej Apr 12, 2022
3db1a6b
Updated maven plugins
dmatej Apr 12, 2022
cc9eb2e
TCK cleanup
dmatej Apr 12, 2022
11ed0f3
Stabilized admin-tests
dmatej Apr 8, 2022
2a670f1
mvn package should pass after mvn clean install -Pfastest -T4C too
dmatej Apr 11, 2022
3d3e961
Updated >project< artifact to 1.0.7
dmatej Apr 12, 2022
32b2a41
RestModelExtensionProcessor class cleanup
dmatej Apr 11, 2022
1be299b
Fixed build_re_dev used on Eclipse's Jenkins
dmatej Apr 11, 2022
4215016
Removed enforcer versions (inherited)
dmatej Apr 12, 2022
2497c55
Merge remote-tracking branch 'eclipse/6.x' into sync-6.x-to-master220412
dmatej Apr 12, 2022
c1f51c0
#23507 Using glassfish7 directory name
dmatej Apr 13, 2022
9f43a95
Updated Readme.txt
dmatej Apr 13, 2022
7510041
Improved failing OSGiCommandsITest
dmatej Apr 13, 2022
85e5290
AdminMain now can print stacktraces
dmatej Apr 13, 2022
559f4ba
Parser - just a quick cleanup and nicer NPE message
dmatej Apr 13, 2022
b865744
Logging errors in RemoteCommands as severe, not as finer
dmatej Apr 13, 2022
9742548
Fixed OSGI Shell broken in 00bbae07f2
dmatej Apr 13, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The Zip distributions can be found on following paths:
### Prerequisites

* JDK11+
* Maven 3.5.4+
* Maven 3.6.0+

### Execution

Expand Down Expand Up @@ -84,8 +84,6 @@ They are quite old and have high technical debt, but at this moment they still p
* `./runtests.sh web_jsp` - Usual time: 8 minutes
* `./runtests.sh webservice_all` - Usual time: 10 minutes
* `./gfbuild.sh archive_bundles && ./gftest.sh ejb_web_all` - Usual time: 4 minutes
* `./gfbuild.sh archive_bundles && ./gftest.sh nucleus_admin_all` - Not fixed yet
* `./gfbuild.sh archive_bundles && ./gftest.sh ql_gf_nucleus_all` - Not fixed yet
* `./gfbuild.sh archive_bundles && ./gftest.sh ql_gf_web_profile_all` - Usual time: 2 minutes
* `./gfbuild.sh archive_bundles && ./gftest.sh ql_gf_full_profile_all` - Usual time: 4 minutes

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2022 Contributors to the Eclipse Foundation
* Copyright (c) 2009, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -138,7 +139,7 @@ public static void getPhysicalDestination(HandlerContext handlerCtx) {
Map valueMap = new HashMap();
try {
String objectName = getJmsDestinationObjectName(SUBTYPE_CONFIG, name, type);
AttributeList attributes = (AttributeList) JMXUtil.getMBeanServer().getAttributes(new ObjectName(objectName), ATTRS_CONFIG);
AttributeList attributes = JMXUtil.getMBeanServer().getAttributes(new ObjectName(objectName), ATTRS_CONFIG);
for (Attribute attribute : attributes.asList()) {
valueMap.put(attribute.getName(), (attribute.getValue() != null) ? attribute.getValue().toString() : null);
}
Expand Down Expand Up @@ -168,7 +169,7 @@ public static void getPhysicalDestinationStats(HandlerContext handlerCtx) {
insureJmsBrokerIsRunning();

String objectName = getJmsDestinationObjectName(SUBTYPE_MONITOR, name, type);
AttributeList attributes = (AttributeList) getMBeanServerConnection(target).getAttributes(new ObjectName(objectName), ATTRS_MONITOR);
AttributeList attributes = getMBeanServerConnection(target).getAttributes(new ObjectName(objectName), ATTRS_MONITOR);
ResourceBundle bundle = GuiUtil.getBundle("org.glassfish.jms.admingui.Strings");
statsList.add(createRow("Name", name, ""));
statsList.add(createRow("Type", type.substring(0, 1).toUpperCase(GuiUtil.guiLocale) + type.substring(1), ""));
Expand Down Expand Up @@ -208,12 +209,12 @@ public static void getPhysicalDestinations(HandlerContext handlerCtx) {
List<Map> selectedList = (List) handlerCtx.getInputValue("selectedRows");
boolean hasOrig = (selectedList == null || selectedList.size() == 0) ? false : true;

for (int i = 0; i < objectNames.length; i++) {
for (ObjectName objectName : objectNames) {
// getAttributes for the given objectName...
HashMap oneRow = new HashMap();
oneRow.put("name", objectNames[i].getKeyProperty(PROP_NAME).replaceAll("\"", ""));
oneRow.put("type", "t".equals(objectNames[i].getKeyProperty(PROP_DEST_TYPE)) ? "topic" : "queue");
oneRow.put("selected", (hasOrig) ? isSelected(objectNames[i].getKeyProperty(PROP_NAME), selectedList) : false);
oneRow.put("name", objectName.getKeyProperty(PROP_NAME).replaceAll("\"", ""));
oneRow.put("type", "t".equals(objectName.getKeyProperty(PROP_DEST_TYPE)) ? "topic" : "queue");
oneRow.put("selected", (hasOrig) ? isSelected(objectName.getKeyProperty(PROP_NAME), selectedList) : false);
result.add(oneRow);
}

Expand Down Expand Up @@ -287,7 +288,7 @@ public static void updatePhysicalDestination(HandlerContext handlerCtx) {
public static void deleteJMSDest(HandlerContext handlerCtx) {
// String configName = ((String) handlerCtx.getInputValue("targetName"));
List obj = (List) handlerCtx.getInputValue("selectedRows");
List<Map> selectedRows = (List) obj;
List<Map> selectedRows = obj;
try {
for (Map oneRow : selectedRows) {
String name = (String) oneRow.get("name");
Expand Down Expand Up @@ -403,7 +404,7 @@ protected static void buildAttributeList(AttributeList list, Map attrMap, String
list.add(new Attribute(ATTR_MAX_NUM_MSGS, Long.parseLong((String) attrMap.get(ATTR_MAX_NUM_MSGS))));
list.add(new Attribute(ATTR_MAX_BYTES_PER_MSG, Long.parseLong((String) attrMap.get(ATTR_MAX_BYTES_PER_MSG))));
list.add(new Attribute(ATTR_MAX_TOTAL_MSG_BYTES, Long.parseLong((String) attrMap.get(ATTR_MAX_TOTAL_MSG_BYTES))));
list.add(new Attribute(ATTR_LIMIT_BEHAVIOR, (String) attrMap.get(ATTR_LIMIT_BEHAVIOR)));
list.add(new Attribute(ATTR_LIMIT_BEHAVIOR, attrMap.get(ATTR_LIMIT_BEHAVIOR)));
list.add(new Attribute(ATTR_MAX_NUM_PRODUCERS, Integer.parseInt((String) attrMap.get(ATTR_MAX_NUM_PRODUCERS))));
if ("queue".equals(type)) {
list.add(new Attribute(ATTR_MAX_NUM_ACTIVE_CONSUMERS, Integer.parseInt((String) attrMap.get(ATTR_MAX_NUM_ACTIVE_CONSUMERS))));
Expand All @@ -413,7 +414,7 @@ protected static void buildAttributeList(AttributeList list, Map attrMap, String
list.add(new Attribute(ATTR_CONSUMER_FLOW_LIMIT, Long.parseLong((String) attrMap.get(ATTR_CONSUMER_FLOW_LIMIT))));
list.add(new Attribute(ATTR_USE_DMQ, Boolean.valueOf((String) attrMap.get(ATTR_USE_DMQ))));
list.add(new Attribute(ATTR_VALIDATE_XML_SCHEMA_ENABLED, Boolean.valueOf((String) attrMap.get(ATTR_VALIDATE_XML_SCHEMA_ENABLED))));
list.add(new Attribute(ATTR_XML_SCHEMA_URI_LIST, (String) attrMap.get(ATTR_XML_SCHEMA_URI_LIST)));
list.add(new Attribute(ATTR_XML_SCHEMA_URI_LIST, attrMap.get(ATTR_XML_SCHEMA_URI_LIST)));
}

protected static void insureJmsBrokerIsRunning() throws ConnectorRuntimeException {
Expand Down Expand Up @@ -444,14 +445,15 @@ private static MBeanServerConnection getMBeanServerConnection(String target) thr
}

PhysicalDestinations pd = new PhysicalDestinations();
MQJMXConnectorInfo mqInfo = pd.getConnectorInfo(target, configRef, habitat, domain);

return mqInfo.getMQMBeanServerConnection();
try (MQJMXConnectorInfo mqInfo = pd.createConnectorInfo(target, configRef, habitat, domain)) {
// fyi, the connection is just a description, not closeable.
return mqInfo.getMQMBeanServerConnection();
}
}

private static class PhysicalDestinations extends JMSDestination {
public MQJMXConnectorInfo getConnectorInfo(String target, String configName, ServiceLocator habitat, Domain domain) throws Exception {
return getMQJMXConnectorInfo(target, domain.getConfigNamed(configName), habitat.<ServerContext>getService(ServerContext.class),
public MQJMXConnectorInfo createConnectorInfo(String target, String configName, ServiceLocator habitat, Domain domain) throws Exception {
return createMQJMXConnectorInfo(target, domain.getConfigNamed(configName), habitat.<ServerContext>getService(ServerContext.class),
domain, habitat.<ConnectorRuntime>getService(ConnectorRuntime.class));
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2022 Contributors to the Eclipse Foundation
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -236,7 +237,7 @@ public static AppClientContainer.Builder newBuilder(

private URLClassLoader classLoader = (URLClassLoader) Thread.currentThread().getContextClassLoader();

private Collection<EntityManagerFactory> emfs = null;
private final Collection<EntityManagerFactory> emfs = null;

// private boolean isJWS = false;

Expand Down Expand Up @@ -354,7 +355,7 @@ private void completePreparation(final Instrumentation inst) throws
* Allow pre-destroy handling to work on the main class during clean-up.
*/
cleanup.setInjectionManager(injectionManager,
clientMainClassSetting.clientMainClass);
ClientMainClassSetting.clientMainClass);

/*
* If this app client contains persistence unit refs, then initialize
Expand Down Expand Up @@ -456,9 +457,10 @@ public Map<Thread, StackTraceElement[]> run() {

private void cleanupWhenSafe() {
if (isEDTRunning()) {
final AtomicReference<Thread> edt = new AtomicReference<Thread>();
final AtomicReference<Thread> edt = new AtomicReference<>();
try {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
edt.set(Thread.currentThread());
}
Expand Down Expand Up @@ -495,7 +497,7 @@ private Method getMainMethod() throws NoSuchMethodException,
// String[] as the only argument
Method result = null;

result = clientMainClassSetting.getClientMainClass(
result = ClientMainClassSetting.getClientMainClass(
classLoader,
injectionManager,
invocationManager,
Expand Down Expand Up @@ -726,34 +728,34 @@ void setClassLoader(ACCClassLoader classLoader) {
*/
public interface Builder {

public AppClientContainer newContainer(URI archiveURI) throws Exception, UserError;
AppClientContainer newContainer(URI archiveURI) throws Exception, UserError;

public AppClientContainer newContainer(URI archiveURI,
AppClientContainer newContainer(URI archiveURI,
CallbackHandler callbackHandler,
String mainClassName,
String appName) throws Exception, UserError;

public AppClientContainer newContainer(URI archiveURI,
AppClientContainer newContainer(URI archiveURI,
CallbackHandler callbackHandler,
String mainClassName,
String appName,
boolean isTextAuth) throws Exception, UserError;



public AppClientContainer newContainer(Class mainClass) throws Exception, UserError;
AppClientContainer newContainer(Class mainClass) throws Exception, UserError;

public TargetServer[] getTargetServers();
TargetServer[] getTargetServers();

/**
* Adds an optional {@link MessageSecurityConfig} setting.
*
* @param msConfig the new MessageSecurityConfig
* @return the <code>Builder</code> instance
*/
public Builder addMessageSecurityConfig(final MessageSecurityConfig msConfig);
Builder addMessageSecurityConfig(final MessageSecurityConfig msConfig);

public List<MessageSecurityConfig> getMessageSecurityConfig();
List<MessageSecurityConfig> getMessageSecurityConfig();

/**
* Sets the optional authentication realm for the ACC.
Expand All @@ -764,9 +766,9 @@ public AppClientContainer newContainer(URI archiveURI,
* @param className name of the class which implements the realm
* @return the <code>Builder</code> instance
*/
public Builder authRealm(final String className);
Builder authRealm(final String className);

public AuthRealm getAuthRealm();
AuthRealm getAuthRealm();

// /**
// * Sets the callback handler the ACC will use when authentication is
Expand Down Expand Up @@ -799,9 +801,9 @@ public AppClientContainer newContainer(URI archiveURI,
* @param password password valid in the default realm on the server for the username
* @return the <code>Builder</code> instance
*/
public Builder clientCredentials(final String user, final char[] password);
Builder clientCredentials(final String user, final char[] password);

public ClientCredential getClientCredential();
ClientCredential getClientCredential();

/**
* Sets the optional client credentials and server-side realm to be used during
Expand All @@ -816,15 +818,15 @@ public AppClientContainer newContainer(URI archiveURI,
* @param realmName name of the realm on the server within which the credentials are valid
* @return the <code>Builder</code> instance
*/
public Builder clientCredentials(final String user, final char[] password, final String realm);
Builder clientCredentials(final String user, final char[] password, final String realm);

/**
* Sets the container-level Properties.
*
* @param containerProperties
* @return
*/
public Builder containerProperties(final Properties containerProperties);
Builder containerProperties(final Properties containerProperties);

/**
* Sets the container-level properties.
Expand All @@ -835,23 +837,23 @@ public AppClientContainer newContainer(URI archiveURI,
* @param containerProperties Property objects to use in setting the properties
* @return
*/
public Builder containerProperties(final List<Property> containerProperties);
Builder containerProperties(final List<Property> containerProperties);

/**
* Returns the container-level Properties.
* @return container-level properties
*/
public Properties getContainerProperties();
Properties getContainerProperties();

/**
* Sets the logger which the ACC should use as it runs.
*
* @param logger
* @return
*/
public Builder logger(final Logger logger);
Builder logger(final Logger logger);

public Logger getLogger();
Logger getLogger();

/**
* Sets whether the ACC should send the password to the server during
Expand All @@ -860,9 +862,9 @@ public AppClientContainer newContainer(URI archiveURI,
* @param sendPassword
* @return
*/
public Builder sendPassword(final boolean sendPassword);
Builder sendPassword(final boolean sendPassword);

public boolean getSendPassword();
boolean getSendPassword();

}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2022 Contributors to the Eclipse Foundation
* Copyright (c) 2010, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand All @@ -17,23 +18,26 @@
package org.glassfish.ha.commands;

import com.sun.enterprise.config.serverbeans.Domain;
import java.util.*;

import jakarta.validation.constraints.Pattern;

import java.util.ArrayList;
import java.util.Properties;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.glassfish.api.ActionReport;
import org.glassfish.api.I18n;
import org.glassfish.api.Param;
import org.glassfish.api.admin.AdminCommand;
import org.glassfish.api.admin.AdminCommandContext;
import org.glassfish.api.admin.CommandLock;

import org.jvnet.hk2.annotations.Service;
import org.glassfish.hk2.api.PerLookup;

import jakarta.validation.constraints.Pattern;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.glassfish.api.admin.*;
import org.glassfish.api.admin.RestEndpoint;
import org.glassfish.api.admin.RestEndpoints;
import org.glassfish.ha.store.spi.BackingStoreFactoryRegistry;
import org.glassfish.hk2.api.PerLookup;
import org.jvnet.hk2.annotations.Service;

/**
* The list-persistence-types command lists different kinds of persistence options for session data
Expand All @@ -51,10 +55,12 @@
})
public class ListPersistenceTypesCommand implements AdminCommand {

@Param(name="type", optional=false, primary=false)
private static final String CONTAINER_TYPES = "(ejb|web)";

@Param(name = "type", optional = false, primary = false)
@I18n("list.persistence.types.container")
@Pattern(regexp = "(ejb|web)")
private String containerType = "";
@Pattern(regexp = CONTAINER_TYPES, message = "Valid values: " + CONTAINER_TYPES)
private final String containerType = "";

private Logger logger;
private static final String EOL = "\n";
Expand Down Expand Up @@ -89,7 +95,7 @@ public void execute(AdminCommandContext context) {
output = output.substring(0, output.length()-1);
}
Properties extraProperties = new Properties();
extraProperties.put("types", new ArrayList<String>(allPersistenceTypes));
extraProperties.put("types", new ArrayList<>(allPersistenceTypes));

report.setExtraProperties(extraProperties);
report.setMessage(output);
Expand Down
Loading