Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.apache.ignite.internal.processors.cache.persistence.file.AsyncFileIOFactory;
import org.apache.ignite.internal.processors.cache.persistence.file.FileIOFactory;
import org.apache.ignite.internal.processors.cache.persistence.file.RandomAccessFileIOFactory;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.A;
import org.apache.ignite.internal.util.typedef.internal.S;
Expand Down Expand Up @@ -301,6 +302,7 @@ public class DataStorageConfiguration implements Serializable {
private boolean alwaysWriteFullPages = DFLT_WAL_ALWAYS_WRITE_FULL_PAGES;

/** Factory to provide I/O interface for data storage files */
@GridToStringExclude
private FileIOFactory fileIOFactory =
IgniteSystemProperties.getBoolean(IGNITE_USE_ASYNC_FILE_IO_FACTORY, DFLT_USE_ASYNC_FILE_IO_FACTORY) ?
new AsyncFileIOFactory() : new RandomAccessFileIOFactory();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@
package org.apache.ignite.configuration;

import java.io.Serializable;

import org.apache.ignite.internal.util.tostring.GridToStringExclude;
import org.apache.ignite.internal.util.typedef.internal.A;

/**
* Encryption configuration.
*/
@GridToStringExclude
public class EncryptionConfiguration implements Serializable {
/** */
private static final long serialVersionUID = 0L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import org.apache.ignite.failure.FailureHandler;
import org.apache.ignite.internal.managers.eventstorage.GridEventStorageManager;
import org.apache.ignite.internal.processors.odbc.ClientListenerProcessor;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
import org.apache.ignite.internal.util.typedef.internal.A;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
Expand Down Expand Up @@ -326,6 +327,7 @@ public class IgniteConfiguration {
private String igniteWorkDir;

/** MBean server. */
@GridToStringExclude
private MBeanServer mbeanSrv;

/** Local node ID. */
Expand Down Expand Up @@ -389,42 +391,54 @@ public class IgniteConfiguration {
private long segChkFreq = DFLT_SEG_CHK_FREQ;

/** Communication SPI. */
@GridToStringExclude
private CommunicationSpi commSpi;

/** Event storage SPI. */
@GridToStringExclude
private EventStorageSpi evtSpi;

/** Collision SPI. */
@GridToStringExclude
private CollisionSpi colSpi;

/** Deployment SPI. */
@GridToStringExclude
private DeploymentSpi deploySpi;

/** Checkpoint SPI. */
@GridToStringExclude
private CheckpointSpi[] cpSpi;

/** Failover SPI. */
@GridToStringExclude
private FailoverSpi[] failSpi;

/** Load balancing SPI. */
@GridToStringExclude
private LoadBalancingSpi[] loadBalancingSpi;

/** Indexing SPI. */
@GridToStringExclude
private IndexingSpi indexingSpi;

/** Address resolver. */
private AddressResolver addrRslvr;

/** Encryption SPI. */
@GridToStringExclude
private EncryptionSpi encryptionSpi;

/** Metric exporter SPI. */
@GridToStringExclude
private MetricExporterSpi[] metricExporterSpi;

/** System view exporter SPI. */
@GridToStringExclude
private SystemViewExporterSpi[] sysViewExporterSpi;

/** Tracing SPI. */
@GridToStringExclude
private TracingSpi tracingSpi;

/** Cache configurations. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import java.io.Serializable;
import org.apache.ignite.internal.util.typedef.internal.A;
import org.apache.ignite.internal.util.typedef.internal.S;

/**
* This class allows defining system data region configuration with various parameters for Apache Ignite
Expand Down Expand Up @@ -90,4 +91,9 @@ public SystemDataRegionConfiguration setMaxSize(long maxSize) {

return this;
}

/** {@inheritDoc} */
@Override public String toString() {
return S.toString(SystemDataRegionConfiguration.class, this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements IgniteDiscovery
private Marshaller marsh;

/** Statistics. */
@GridToStringExclude
protected final TcpDiscoveryStatistics stats = new TcpDiscoveryStatistics();

/** Local port which node uses. */
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* 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.
*/

package org.apache.ignite.configuration;

import java.util.regex.Pattern;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.testframework.ListeningTestLogger;
import org.apache.ignite.testframework.LogListener;
import org.apache.ignite.testframework.junits.WithSystemProperty;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.junit.Assert;
import org.junit.Test;

import static org.apache.ignite.IgniteSystemProperties.IGNITE_QUIET;

/**
* Test covers cases where Ignite configuration,
* or it's nested objects has default implementation of {@link Object#toString()}
*/
@WithSystemProperty(key = IGNITE_QUIET, value = "false")
public class IgniteConfigurationTest extends GridCommonAbstractTest {
/** Error message to be prompted */
private static final String ASSERTION_ERROR_MESSAGE =
"Ignite configuration log message contains objects with default toString implementation!";

/** Pattern to check any object has default {@link Object#toString()} implementation */
private static final Pattern ERROR_PATTERN = Pattern.compile("^(?=.*IgniteConfiguration \\[)(?!.*@\\d+).*$");

/** */
private final ListeningTestLogger listeningLog = new ListeningTestLogger(log);

/**
* Check ignite configuration log message contains no @ letters
* It's a common way to ensure all objects in prompt has {@link Object#toString()} overriden
*/
@Test
public void testIgniteConfigurationPrompt() throws Exception {
LogListener igniteConfigurationLogListener = LogListener
.matches(ERROR_PATTERN)
.atLeast(1)
.build();
listeningLog.registerListener(igniteConfigurationLogListener);
try (IgniteEx ignored = startGrid(0)) {
Assert.assertTrue(ASSERTION_ERROR_MESSAGE, igniteConfigurationLogListener.check());
}
}

/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
return super.getConfiguration(igniteInstanceName)
.setGridLogger(listeningLog);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import org.apache.ignite.ClassPathContentLoggingTest;
import org.apache.ignite.cache.RemoveAllDeadlockTest;
import org.apache.ignite.configuration.IgniteConfigurationTest;
import org.apache.ignite.events.ClusterActivationStartedEventTest;
import org.apache.ignite.failure.ExchangeTaskHandlerWaitingForTasksTest;
import org.apache.ignite.failure.FailureHandlerTriggeredTest;
Expand Down Expand Up @@ -227,6 +228,8 @@

FreeListCutTailDifferentGcTest.class,
MdcCacheReadRequestsRoutingTest.class,

IgniteConfigurationTest.class,
})
public class IgniteBasicTestSuite2 {
}