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

GEODE-7634: create an ArchUnitTest that asserts that geode-core only … #4549

Merged
merged 5 commits into from
Jan 1, 2020

Conversation

bschuchardt
Copy link
Contributor

@bschuchardt bschuchardt commented Dec 30, 2019

…uses the membership API

creating a new test to enforce use of membership APIs.

This PR also deletes old deprecated loadEmergencyClasses methods and associated
state from a number of classes. That functionality was never integrated fully into membership
anyway.

Membership API classes and interfaces are now in membership.api instead of being buried in membership.gms.api. This simplifies ArchUnitTest rules.

HostAddress is duplicated and the copy is named LocatorAddress. This new class is
specifically for client cache connection pool use. The HostAddress class is retained and is now used
only by membership.

Thank you for submitting a contribution to Apache Geode.

In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:

For all changes:

  • Is there a JIRA ticket associated with this PR? Is it referenced in the commit message?

  • Has your PR been rebased against the latest commit within the target branch (typically develop)?

  • Is your initial contribution a single, squashed commit?

  • Does gradlew build run cleanly?

  • Have you written or updated unit tests to verify your changes?

  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?

Note:

Please ensure that once the PR is submitted, check Concourse for build issues and
submit an update to your PR as soon as possible. If you need help, please send an
email to dev@geode.apache.org.

@bschuchardt bschuchardt marked this pull request as ready for review December 31, 2019 21:14
Copy link
Contributor

@echobravopapa echobravopapa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Package rename, is good. NASA won't like the lack of emergency classes, but we'll worry about that next year...
duplication of LocatorAddress is my only nitpik

@@ -363,15 +358,15 @@ public void testLocatorAndTwoServersJoinUsingDiffeHellman() throws Exception {
// manager queues new views for processing through the DM listener,
// which is a mock object in this test
System.out.println("waiting for views to stabilize");
JoinLeave jl1 = ((GMSMembership) m1).getServices().getJoinLeave();
JoinLeave jl2 = ((GMSMembership) m2).getServices().getJoinLeave();
final Membership mgr1 = m1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

like this, test at the API boundary!

* This test class can be removed if and when we create an isolated Java module that does
* not export internal membership classes.
*/
public class CoreOnlyUsesMembershipAPIArchUnitTest {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like how this is segmented, very much. only concern is that a new package ( or renamed package) will require manual entry into this list- aka how do we go about having an automated way to catch any new violations?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't figure that one out. Any attempts met with OOME when run from gradle. That concern will go away when we start using Jigsaw and enforce API use.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figured as much, just something to keep an eye on...


import org.apache.commons.validator.routines.InetAddressValidator;

public class LocatorAddress {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks like a clone of HostAddress, curious why we want to have both classes...?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like avoidable duplication

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll do something about that. I don't much like it either.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to move LocatorAddress to the geode-tcp-server module and subclass it in membership for HostAddress.

@@ -114,32 +112,6 @@ void startupMessageFailed(InternalDistributedMember mbr,

Set<InternalDistributedMember> getMembersNotShuttingDown();

// TODO - this method is only used by tests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to see test hooks reducing.

@@ -638,49 +612,6 @@ public DistributedMember getCoordinator() {
return membership.getMembersNotShuttingDown();
}

// TODO - this method is only used by tests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

…uses the membership API

creating a new test to enforce use of membership APIs.  There are a few
exceptions in test code, plus others that aren't in the "integration
test" source set.
Copy link
Contributor

@echobravopapa echobravopapa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apologies if I caused those conflicts with my latest merge

@bschuchardt bschuchardt merged commit 263b3e2 into develop Jan 1, 2020
@bschuchardt bschuchardt deleted the feature/GEODE-7634 branch January 1, 2020 03:13
davebarnes97 pushed a commit to davebarnes97/geode that referenced this pull request Jan 22, 2020
apache#4549)

* GEODE-7634: create an ArchUnitTest that asserts that geode-core only uses the membership API

creating a new test to enforce use of membership APIs.  There are a few
exceptions in test code, plus others that aren't in the "integration
test" source set.

* removing test dependencies and fixing crashDistributedSystem method

* moved membership API classes to membership.api package and fixed OOME

* move address verification class to tcp-server module and subclass in membership

* rebasing on Ernie's GeodeGlossary stuff
mhansonp pushed a commit to mhansonp/geode that referenced this pull request Mar 12, 2020
apache#4549)

* GEODE-7634: create an ArchUnitTest that asserts that geode-core only uses the membership API

creating a new test to enforce use of membership APIs.  There are a few
exceptions in test code, plus others that aren't in the "integration
test" source set.

* removing test dependencies and fixing crashDistributedSystem method

* moved membership API classes to membership.api package and fixed OOME

* move address verification class to tcp-server module and subclass in membership

* rebasing on Ernie's GeodeGlossary stuff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants