Skip to content

Commit b45b843

Browse files
antonovsergey93mcherkasov
authored andcommitted
IGNITE-11631 Fix NPE on server with persistence and SSL start.
(cherry picked from commit 2871893)
1 parent 8e45763 commit b45b843

File tree

3 files changed

+67
-16
lines changed

3 files changed

+67
-16
lines changed

modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2085,8 +2085,6 @@ protected void onExchange(DiscoveryDataPacket dataPacket, ClassLoader clsLdr) {
20852085

20862086
/** {@inheritDoc} */
20872087
@Override public void spiStart(@Nullable String igniteInstanceName) throws IgniteSpiException {
2088-
sslEnable = ignite().configuration().getSslContextFactory() != null;
2089-
20902088
initializeImpl();
20912089

20922090
registerMBean(igniteInstanceName, new TcpDiscoverySpiMBeanImpl(this), TcpDiscoverySpiMBean.class);
@@ -2101,6 +2099,8 @@ private void initializeImpl() {
21012099
if (impl != null)
21022100
return;
21032101

2102+
sslEnable = ignite().configuration().getSslContextFactory() != null;
2103+
21042104
initFailureDetectionTimeout();
21052105

21062106
if (!forceSrvMode && (Boolean.TRUE.equals(ignite.configuration().isClientMode()))) {
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.ignite.spi.communication.tcp;
19+
20+
import org.apache.ignite.configuration.DataRegionConfiguration;
21+
import org.apache.ignite.configuration.DataStorageConfiguration;
22+
import org.apache.ignite.configuration.IgniteConfiguration;
23+
import org.apache.ignite.failure.StopNodeFailureHandler;
24+
25+
/**
26+
*
27+
*/
28+
public class IgniteCacheSslStartStopWithPersistenceSelfTest extends IgniteCacheSslStartStopSelfTest {
29+
/** {@inheritDoc} */
30+
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
31+
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
32+
33+
cfg.setFailureHandler(new StopNodeFailureHandler());
34+
35+
cfg.setDataStorageConfiguration(
36+
new DataStorageConfiguration()
37+
.setDefaultDataRegionConfiguration(new DataRegionConfiguration().setPersistenceEnabled(true))
38+
);
39+
40+
return cfg;
41+
}
42+
43+
/** {@inheritDoc} */
44+
@Override protected void beforeTestsStarted() throws Exception {
45+
cleanPersistenceDir();
46+
47+
super.beforeTestsStarted();
48+
}
49+
50+
/** {@inheritDoc} */
51+
@Override protected void afterTestsStopped() throws Exception {
52+
super.afterTestsStopped();
53+
54+
cleanPersistenceDir();
55+
}
56+
}

modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuiteSsl.java

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,17 @@
2020
import junit.framework.TestSuite;
2121
import org.apache.ignite.internal.util.IgniteUtils;
2222
import org.apache.ignite.spi.communication.tcp.IgniteCacheSslStartStopSelfTest;
23+
import org.apache.ignite.spi.communication.tcp.IgniteCacheSslStartStopWithPersistenceSelfTest;
24+
import org.junit.runner.RunWith;
25+
import org.junit.runners.Suite;
2326

2427
/**
2528
* Test suite.
2629
*/
27-
public class IgniteCacheFailoverTestSuiteSsl extends TestSuite {
28-
/**
29-
* @return Ignite Cache Failover test suite.
30-
* @throws Exception Thrown in case of the failure.
31-
*/
32-
public static TestSuite suite() throws Exception {
33-
TestSuite suite = new TestSuite("Cache Failover Test Suite SSL");
34-
35-
// Disable SSL test with old JDK because of https://bugs.openjdk.java.net/browse/JDK-8013809.
36-
if (!IgniteUtils.isHotSpot() || IgniteUtils.isJavaVersionAtLeast("1.7.0_65"))
37-
suite.addTestSuite(IgniteCacheSslStartStopSelfTest.class);
38-
39-
return suite;
40-
}
30+
@RunWith(Suite.class)
31+
@Suite.SuiteClasses({
32+
IgniteCacheSslStartStopSelfTest.class,
33+
IgniteCacheSslStartStopWithPersistenceSelfTest.class
34+
})
35+
public class IgniteCacheFailoverTestSuiteSsl {
4136
}

0 commit comments

Comments
 (0)