Skip to content

Commit 0385975

Browse files
committed
Initial fixes before testing
1 parent 059da08 commit 0385975

File tree

4 files changed

+54
-27
lines changed

4 files changed

+54
-27
lines changed

enterprise/glassfish.common/src/org/netbeans/modules/glassfish/common/ServerDetails.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,8 +584,8 @@ public enum ServerDetails {
584584
GLASSFISH_SERVER_8_0_0(NbBundle.getMessage(ServerDetails.class, "STR_800_SERVER_NAME", new Object[]{}), // NOI18N
585585
GlassfishInstanceProvider.JAKARTAEE11_DEPLOYER_FRAGMENT,
586586
GlassFishVersion.GF_8_0_0,
587-
"https://repo.maven.apache.org/maven2/org/glassfish/main/distributions/glassfish/8.0.0-M12/glassfish-8.0.0-M14.zip", // NOI18N
588-
"https://repo.maven.apache.org/maven2/org/glassfish/main/distributions/glassfish/8.0.0-M12/glassfish-8.0.0-M14.zip", // NOI18N
587+
"https://repo.maven.apache.org/maven2/org/glassfish/main/distributions/glassfish/8.0.0-M14/glassfish-8.0.0-M14.zip", // NOI18N
588+
"https://repo.maven.apache.org/maven2/org/glassfish/main/distributions/glassfish/8.0.0-M14/glassfish-8.0.0-M14.zip", // NOI18N
589589
"http://www.eclipse.org/legal/epl-2.0" //NOI18N
590590
);
591591

enterprise/glassfish.tooling/src/org/netbeans/modules/glassfish/tooling/server/config/GlassFishV7_1_0.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
</fileset>
7676
</classpath>
7777
<javadocs>
78-
<link url="https://repo.maven.apache.org/maven2/org/glassfish/jersey/jersey-documentation/3.1.10/jersey-documentation-3.1.10-docbook.zip"/>
78+
<link url="https://repo.maven.apache.org/maven2/org/glassfish/jersey/jersey-documentation/3.1.11/jersey-documentation-3.1.11-docbook.zip"/>
7979
</javadocs>
8080
<sources>
8181
</sources>

enterprise/glassfish.tooling/src/org/netbeans/modules/glassfish/tooling/utils/ServerUtils.java

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -557,37 +557,38 @@ public static GlassFishVersion getServerVersion(final String serverHome) {
557557
ClassLoader cl = new URLClassLoader(new URL[] {commonUtilJar.
558558
toURI().toURL()});
559559
Class c = cl.loadClass(VERSION_CLASS);
560-
// Try to get version from com.sun.appserv.server.util.Version.
561-
try {
562-
Method mGetFullVersion = c.getMethod(VERSION_METHOD);
563-
System.getProperties().put(GF_HOME_PROPERTY, serverHome);
564-
String fullVersionString
565-
= (String)mGetFullVersion.invoke(c);
566-
System.getProperties().remove(GF_HOME_PROPERTY);
567-
String versionString
568-
= getVersionString(fullVersionString);
560+
561+
// Use Manifest Bundle-Version.
562+
try (JarFile jar = new JarFile(commonUtilJar)) {
563+
Manifest manifest = jar.getManifest();
564+
String versionString = getVersionString(manifest
565+
.getMainAttributes().getValue(BUNDLE_VERSION));
569566
if (versionString != null) {
570567
version = GlassFishVersion.toValue(versionString);
571568
}
572-
} catch (IllegalAccessException | IllegalArgumentException
573-
| InvocationTargetException | NoSuchMethodException
574-
| SecurityException | NoClassDefFoundError ex) {
575-
Logger.log(Level.WARNING, "Cannot retrieve Glassfish version from: "
576-
+ commonUtilJar.getAbsolutePath() + ". "
577-
+ "Using Manifest Bundle-Version as fallback option:", ex);
569+
} catch (IOException ioe) {
570+
Logger.log(Level.WARNING, "Cannot retrieve Glassfish version from Manifest: "
571+
+ commonUtilJar.getAbsolutePath() + ": ", ioe);
578572
}
579-
// Use Manifest Bundle-Version as fallback option.
573+
580574
if (version == null) {
581-
try (JarFile jar = new JarFile(commonUtilJar)) {
582-
Manifest manifest = jar.getManifest();
583-
String versionString = getVersionString(manifest
584-
.getMainAttributes().getValue(BUNDLE_VERSION));
575+
// Try to get version from com.sun.appserv.server.util.Version as fallback option.
576+
try {
577+
Method mGetFullVersion = c.getMethod(VERSION_METHOD);
578+
System.getProperties().put(GF_HOME_PROPERTY, serverHome);
579+
String fullVersionString = (String)mGetFullVersion.invoke(c);
580+
System.getProperties().remove(GF_HOME_PROPERTY);
581+
String versionString
582+
= getVersionString(fullVersionString);
585583
if (versionString != null) {
586584
version = GlassFishVersion.toValue(versionString);
587585
}
588-
} catch (IOException ioe) {
589-
Logger.log(Level.WARNING, "Cannot retrieve Glassfish version from Manifest: "
590-
+ commonUtilJar.getAbsolutePath() + ": ", ioe);
586+
} catch (IllegalAccessException | IllegalArgumentException
587+
| InvocationTargetException | NoSuchMethodException
588+
| SecurityException | NoClassDefFoundError ex) {
589+
Logger.log(Level.WARNING, "Cannot retrieve Glassfish version from: "
590+
+ commonUtilJar.getAbsolutePath() + ". "
591+
+ "Using Manifest Bundle-Version as fallback option:", ex);
591592
}
592593
}
593594
} catch (MalformedURLException | ClassNotFoundException ex) {

enterprise/glassfish.tooling/test/unit/src/org/netbeans/modules/glassfish/tooling/admin/AdminFactoryTest.java

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,39 @@ public void testGetInstanceforVersionGF6() {
165165
}
166166

167167
/**
168-
* Test factory functionality for GlassFish v. 7.1.0
168+
* Test factory functionality for GlassFish v. 7.0.25
169169
* <p/>
170170
* Factory should initialize REST {@code Runner} and point it to
171171
* provided {@code Command} instance.
172172
*/
173173
@Test
174174
public void testGetInstanceforVersionGF7() {
175+
GlassFishServerEntity srv = new GlassFishServerEntity();
176+
srv.setVersion(GlassFishVersion.GF_7_0_25);
177+
AdminFactory af = AdminFactory.getInstance(srv.getVersion());
178+
assertTrue(af instanceof AdminFactoryRest);
179+
Command cmd = new CommandVersion();
180+
Runner runner;
181+
try {
182+
runner = af.getRunner(srv, cmd);
183+
} catch (GlassFishIdeException gfie) {
184+
runner = null;
185+
fail("Exception in Runner initialization: " + gfie.getMessage());
186+
}
187+
// Returned runner should be REST interface.
188+
assertTrue(runner instanceof RunnerRest);
189+
// Stored command entity should be the one we supplied.
190+
assertTrue(cmd.equals(runner.getCommand()));
191+
}
192+
193+
/**
194+
* Test factory functionality for GlassFish v. 7.1.0
195+
* <p/>
196+
* Factory should initialize REST {@code Runner} and point it to
197+
* provided {@code Command} instance.
198+
*/
199+
@Test
200+
public void testGetInstanceforVersionGF71() {
175201
GlassFishServerEntity srv = new GlassFishServerEntity();
176202
srv.setVersion(GlassFishVersion.GF_7_1_0);
177203
AdminFactory af = AdminFactory.getInstance(srv.getVersion());

0 commit comments

Comments
 (0)