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

7951: Factor out commonly used test helper classes from org.openjdk.jmc.common.test into dedicated test library module #451

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -7,7 +7,7 @@ Bundle-Vendor: Oracle Corporation
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Require-Bundle: org.junit,
org.openjdk.jmc.common.test,
org.openjdk.jmc.testlib,
org.openjdk.jmc.rjmx.test,
org.openjdk.jmc.flightrecorder.configuration,
org.openjdk.jmc.flightrecorder.controlpanel.ui,
Expand Down
Expand Up @@ -6,7 +6,7 @@ Bundle-SymbolicName: org.openjdk.jmc.flightrecorder.ext.jfx.test;singleton:=true
Bundle-Vendor: Oracle Corporation
Require-Bundle: org.junit,
org.openjdk.jmc.flightrecorder.ext.jfx,
org.openjdk.jmc.common.test
org.openjdk.jmc.testlib
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Automatic-Module-Name: org.openjdk.jmc.flightrecorder.ext.jfx.test
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
RealCLanger marked this conversation as resolved.
Show resolved Hide resolved
* Copyright (c) 2019, Red Hat Inc. All rights reserved.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
Expand Down Expand Up @@ -34,14 +34,10 @@

package org.openjdk.jmc.flightrecorder.ext.jfx.test;

import static org.junit.Assert.assertEquals;

import java.util.concurrent.RunnableFuture;

import org.junit.Test;
import org.openjdk.jmc.common.item.IItemCollection;
import org.openjdk.jmc.common.test.TestToolkit;
import org.openjdk.jmc.common.test.io.IOResource;
import org.openjdk.jmc.common.unit.IQuantity;
import org.openjdk.jmc.common.unit.UnitLookup;
import org.openjdk.jmc.common.util.IPreferenceValueProvider;
Expand All @@ -51,6 +47,10 @@
import org.openjdk.jmc.flightrecorder.ext.jfx.Messages;
import org.openjdk.jmc.flightrecorder.rules.IResult;
import org.openjdk.jmc.flightrecorder.rules.TypedResult;
import org.openjdk.jmc.test.TestToolkit;
import org.openjdk.jmc.test.io.IOResource;

import static org.junit.Assert.assertEquals;

public class JfxPulseDurationRuleTest {

Expand Down Expand Up @@ -95,5 +95,4 @@ public <T> T getPreferenceValue(TypedPreference<T> preference) {
assertEquals(WARNING_SHORT, result.getSummary());
assertEquals(WARNING_LONG, result.getExplanation());
}

}
Expand Up @@ -7,7 +7,7 @@ Bundle-Vendor: Oracle Corporation
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Require-Bundle: org.junit,
org.openjdk.jmc.common.test,
org.openjdk.jmc.testlib,
org.openjdk.jmc.rjmx.test,
org.openjdk.jmc.rjmx.services.jfr,
org.openjdk.jmc.rjmx,
Expand Down
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
*
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* The contents of this file are subject to the terms of either the Universal Permissive License
Expand All @@ -10,17 +10,17 @@
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions
* and the following disclaimer.
*
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials provided with
* the distribution.
*
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to
* endorse or promote products derived from this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
Expand All @@ -32,8 +32,6 @@
*/
package org.openjdk.jmc.rjmx.services.jfr.test;

import static org.junit.Assert.assertTrue;

import java.io.IOException;
import java.io.InputStream;

Expand All @@ -50,6 +48,8 @@
import org.openjdk.jmc.rjmx.services.jfr.IRecordingDescriptor;
import org.openjdk.jmc.rjmx.test.RjmxTestCase;

import static org.junit.Assert.assertTrue;

/**
* This test suite is supposed to test the example code that we ship with the documentation for the
* org.openjdk.jmc.rjmx.services.jfr bundle. That is, for each code example included in
Expand Down
Expand Up @@ -8,7 +8,7 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Require-Bundle: org.junit,
org.openjdk.jmc.rjmx,
org.openjdk.jmc.common.test
org.openjdk.jmc.testlib
Export-Package: org.openjdk.jmc.rjmx.test,
org.openjdk.jmc.rjmx.test.testutil
Automatic-Module-Name: org.openjdk.jmc.rjmx.test
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
*
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* The contents of this file are subject to the terms of either the Universal Permissive License
Expand All @@ -10,17 +10,17 @@
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions
* and the following disclaimer.
*
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials provided with
* the distribution.
*
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to
* endorse or promote products derived from this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
Expand All @@ -46,7 +46,6 @@
import org.junit.Assume;
import org.junit.Before;
import org.openjdk.jmc.common.io.IOToolkit;
import org.openjdk.jmc.common.test.MCTestCase;
import org.openjdk.jmc.common.version.JavaVersionSupport;
import org.openjdk.jmc.rjmx.ConnectionDescriptorBuilder;
import org.openjdk.jmc.rjmx.ConnectionException;
Expand All @@ -62,6 +61,7 @@
import org.openjdk.jmc.rjmx.subscription.IMBeanHelperService;
import org.openjdk.jmc.rjmx.subscription.IMRIMetadataService;
import org.openjdk.jmc.rjmx.subscription.ISubscriptionService;
import org.openjdk.jmc.test.MCTestCase;
import org.openjdk.jmc.ui.common.jvm.Connectable;
import org.openjdk.jmc.ui.common.jvm.JVMDescriptor;
import org.openjdk.jmc.ui.common.jvm.JVMType;
Expand Down Expand Up @@ -135,7 +135,7 @@ public static IConnectionDescriptor getDefaultConnectionDescriptor() throws Malf

/**
* Creates a server descriptor with information matching the currently running JVM.
*
*
* @return the server descriptor.
*/
public static IServerDescriptor createDefaultServerDesciptor() {
Expand All @@ -150,7 +150,7 @@ public static IServerDescriptor createDefaultServerDesciptor() {
/**
* Creates a server descriptor with information derived from the JVM with the provided
* connection.
*
*
* @param connection
* an active {@link MBeanServerConnection}.
* @return the server descriptor.
Expand All @@ -168,7 +168,7 @@ public static IServerDescriptor createDefaultServerDesciptor(MBeanServerConnecti
/**
* Creates a server descriptor with information derived from the JVM described by the server
* descriptor. Will connect temporarily to derive the information.
*
*
* @param descriptor
* the descriptor defining the JVM to connect to.
* @return the server descriptor, with information derived from the actual connection, or an
Expand Down
Expand Up @@ -8,7 +8,7 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Require-Bundle: org.junit,
org.openjdk.jmc.ui,
org.openjdk.jmc.common.test
org.openjdk.jmc.testlib
Automatic-Module-Name: org.openjdk.jmc.ui.test
Import-Package: org.openjdk.jmc.common,
org.openjdk.jmc.common.unit,
Expand Down
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
*
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* The contents of this file are subject to the terms of either the Universal Permissive License
Expand All @@ -10,17 +10,17 @@
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions
* and the following disclaimer.
*
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials provided with
* the distribution.
*
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to
* endorse or promote products derived from this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
Expand Down Expand Up @@ -48,7 +48,7 @@
import org.junit.runners.Parameterized.Parameters;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
import org.openjdk.jmc.common.test.MCTestCase;
import org.openjdk.jmc.test.MCTestCase;
import org.openjdk.jmc.common.unit.ContentType;
import org.openjdk.jmc.common.unit.ITypedQuantity;
import org.openjdk.jmc.common.unit.LinearKindOfQuantity;
Expand Down
Expand Up @@ -9,7 +9,7 @@ Require-Bundle: org.junit,
org.eclipse.swt,
org.eclipse.ui.ide,
org.eclipse.ui.forms,
org.openjdk.jmc.common.test,
org.openjdk.jmc.testlib,
org.openjdk.jmc.rjmx,
org.openjdk.jmc.rjmx.ui,
org.eclipse.ui,
Expand Down
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
*
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
RealCLanger marked this conversation as resolved.
Show resolved Hide resolved
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* The contents of this file are subject to the terms of either the Universal Permissive License
Expand All @@ -10,17 +10,17 @@
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions
* and the following disclaimer.
*
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials provided with
* the distribution.
*
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to
* endorse or promote products derived from this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
Expand All @@ -40,14 +40,13 @@
import org.junit.Assume;
import org.junit.ClassRule;
import org.junit.Rule;

import org.openjdk.jmc.common.io.IOToolkit;
import org.openjdk.jmc.common.test.TestToolkit;
import org.openjdk.jmc.rjmx.ConnectionException;
import org.openjdk.jmc.rjmx.IConnectionHandle;
import org.openjdk.jmc.rjmx.RJMXPlugin;
import org.openjdk.jmc.rjmx.servermodel.IServer;
import org.openjdk.jmc.rjmx.servermodel.IServerModel;
import org.openjdk.jmc.test.TestToolkit;
import org.openjdk.jmc.test.jemmy.misc.base.wrappers.MCJemmyBase;
import org.openjdk.jmc.test.jemmy.misc.helpers.ConnectionHelper;
import org.openjdk.jmc.test.jemmy.misc.wrappers.MC;
Expand Down Expand Up @@ -230,7 +229,7 @@ protected static int sleep(int ms) {
/**
* Creates a ConnectionHandle for the specified connection, {@code null} if no connection could
* be made
*
*
* @param connectionName
* the name of the connection
* @return a {@link IConnectionHandle}. {@code null} if no connection could be made
Expand Down Expand Up @@ -267,5 +266,4 @@ protected static File getResultDir() {
return new File(System.getProperty("user.dir"));
}
}

}
8 changes: 4 additions & 4 deletions core/org.openjdk.jmc.common/.classpath
Expand Up @@ -17,16 +17,16 @@
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion core/org.openjdk.jmc.common/META-INF/MANIFEST.MF
Expand Up @@ -12,5 +12,5 @@ Export-Package: org.openjdk.jmc.common,
org.openjdk.jmc.common.unit,
org.openjdk.jmc.common.util,
org.openjdk.jmc.common.version
Automatic-Module-Name: org.openjdk.jmc.common
Require-Bundle: org.owasp.encoder, lz4-java
Automatic-Module-Name: org.openjdk.jmc.common
6 changes: 3 additions & 3 deletions core/org.openjdk.jmc.common/pom.xml
Expand Up @@ -39,6 +39,9 @@
<version>${revision}${changelist}</version>
</parent>
<artifactId>common</artifactId>
<properties>
<spotless.config.path>${basedir}/../../configuration/ide/eclipse/formatting/formatting.xml</spotless.config.path>
</properties>
<dependencies>
<dependency>
<groupId>org.owasp.encoder</groupId>
Expand All @@ -51,7 +54,4 @@
<version>1.8.0</version>
</dependency>
</dependencies>
<properties>
<spotless.config.path>${basedir}/../../configuration/ide/eclipse/formatting/formatting.xml</spotless.config.path>
</properties>
</project>
8 changes: 4 additions & 4 deletions core/org.openjdk.jmc.flightrecorder.rules.jdk/.classpath
Expand Up @@ -17,16 +17,16 @@
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
Expand Down