-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MRESOLVER-245] Isolate and update tests (#157)
Main intent is to properly isolate ITs, but did other cleanup as well like patch update of Hazelcast and documentation updated as well. High level changes: * POM update with new patch release of HZ * removed obsolete `destroySemaphore` parameter (always false), factored out semaphore provision * updated all 4 ITs to form random named clusters (hence to prevent outer HZ instance joining) * provided hazelcast and hazelcast-client XML fixed (used wrong schema) * Tests reformatted to maven codestyle (changes best viewed with `?w=1`)
- Loading branch information
Showing
17 changed files
with
618 additions
and
447 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
43 changes: 43 additions & 0 deletions
43
...st/src/main/java/org/eclipse/aether/named/hazelcast/DirectHazelcastSemaphoreProvider.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,43 @@ | ||
package org.eclipse.aether.named.hazelcast; | ||
|
||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import com.hazelcast.core.HazelcastInstance; | ||
import com.hazelcast.cp.ISemaphore; | ||
|
||
/** | ||
* Direct provider of {@link ISemaphore} instances: it simply uses the passed in lock name to create semaphore name out | ||
* of it. This implies, that as many lock names are requested from it, this class will create as many semaphores in | ||
* Hazelcast. | ||
*/ | ||
public class DirectHazelcastSemaphoreProvider extends HazelcastSemaphoreProvider | ||
{ | ||
@Override | ||
public ISemaphore acquireSemaphore( HazelcastInstance hazelcastInstance, String name ) | ||
{ | ||
return hazelcastInstance.getCPSubsystem().getSemaphore( NAME_PREFIX + name ); | ||
} | ||
|
||
@Override | ||
public void releaseSemaphore( HazelcastInstance hazelcastInstance, String name, ISemaphore semaphore ) | ||
{ | ||
// nothing | ||
} | ||
} |
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
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
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
44 changes: 44 additions & 0 deletions
44
...azelcast/src/main/java/org/eclipse/aether/named/hazelcast/HazelcastSemaphoreProvider.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,44 @@ | ||
package org.eclipse.aether.named.hazelcast; | ||
|
||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import com.hazelcast.core.HazelcastInstance; | ||
import com.hazelcast.cp.ISemaphore; | ||
|
||
/** | ||
* Support class for providers of {@link ISemaphore} instances. | ||
*/ | ||
public abstract class HazelcastSemaphoreProvider | ||
{ | ||
/** | ||
* Name prefix recommended using for simpler configuration of Hazelcast. | ||
*/ | ||
protected static final String NAME_PREFIX = "maven:resolver:"; | ||
|
||
/** | ||
* Invoked when new instance of semaphore needed for given name. must not return {@code null}. | ||
*/ | ||
public abstract ISemaphore acquireSemaphore( HazelcastInstance hazelcastInstance, String name ); | ||
|
||
/** | ||
* Invoked when passed in semaphore associated with passed in name is not to be used anymore. | ||
*/ | ||
public abstract void releaseSemaphore( HazelcastInstance hazelcastInstance, String name, ISemaphore semaphore ); | ||
} |
Oops, something went wrong.