mirror of https://github.com/apache/cassandra
add Serializable to Stress settings for daemon mode
patch by cbatey reviewed by dbrosius for CASSANDRA-12564
This commit is contained in:
parent
42bbe00313
commit
03a3f9552c
|
|
@ -22,15 +22,14 @@ package org.apache.cassandra.stress.settings;
|
|||
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import org.apache.cassandra.stress.util.MultiPrintStream;
|
||||
|
||||
public abstract class GroupedOptions
|
||||
public abstract class GroupedOptions implements Serializable
|
||||
{
|
||||
|
||||
int accepted = 0;
|
||||
|
|
@ -142,12 +141,12 @@ public abstract class GroupedOptions
|
|||
return builder.build();
|
||||
}
|
||||
|
||||
public static String formatLong(String longDisplay, String description)
|
||||
static String formatLong(String longDisplay, String description)
|
||||
{
|
||||
return String.format("%-40s %s", longDisplay, description);
|
||||
}
|
||||
|
||||
public static String formatMultiLine(String longDisplay, String description)
|
||||
static String formatMultiLine(String longDisplay, String description)
|
||||
{
|
||||
return String.format("%-36s %s", longDisplay, description);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,9 +21,10 @@ package org.apache.cassandra.stress.settings;
|
|||
*/
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
abstract class Option
|
||||
abstract class Option implements Serializable
|
||||
{
|
||||
|
||||
abstract boolean accept(String param);
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
package org.apache.cassandra.stress.settings;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -26,13 +27,13 @@ import com.google.common.primitives.Ints;
|
|||
|
||||
import org.apache.cassandra.stress.util.MultiPrintStream;
|
||||
|
||||
public class SettingsTokenRange
|
||||
public class SettingsTokenRange implements Serializable
|
||||
{
|
||||
public final boolean wrap;
|
||||
public final int splitFactor;
|
||||
private final TokenRangeOptions options;
|
||||
|
||||
public SettingsTokenRange(TokenRangeOptions options)
|
||||
private SettingsTokenRange(TokenRangeOptions options)
|
||||
{
|
||||
this.options = options;
|
||||
this.wrap = options.wrap.setByUser();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* 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.cassandra.stress.settings;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class StressSettingsTest
|
||||
{
|
||||
@Test
|
||||
public void isSerializable() throws Exception
|
||||
{
|
||||
Map<String, String[]> args = new HashMap<>();
|
||||
args.put("write", new String[] {});
|
||||
StressSettings settings = StressSettings.get(args);
|
||||
// Will throw if not all settings are Serializable
|
||||
new ObjectOutputStream(new ByteArrayOutputStream()).writeObject(settings);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue