![JAR search and dependency download from the Maven repository](/logo.png)
com.xceptance.xlt.nocoding.command.storeDefault.StoreDefaultParameter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xlt-nocoding Show documentation
Show all versions of xlt-nocoding Show documentation
A library based on XLT to run Web test cases that are written in either YAML or CSV format.
The newest version!
/*
* Copyright (c) 2013-2023 Xceptance Software Technologies GmbH
*
* Licensed 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 com.xceptance.xlt.nocoding.command.storeDefault;
import com.xceptance.xlt.api.util.XltLogger;
import com.xceptance.xlt.nocoding.util.Constants;
import com.xceptance.xlt.nocoding.util.context.Context;
import com.xceptance.xlt.nocoding.util.storage.unit.DuplicateStorage;
/**
* Stores a default parameter.
*
* @author ckeiner
*/
public class StoreDefaultParameter extends AbstractStoreDefaultItem
{
/**
* Creates an instance of {@link StoreDefaultParameter} that sets {@link #getVariableName()} and {@link #getValue()}
*
* @param variableName
* The name of the parameter
* @param value
* The default value of the parameter
*/
public StoreDefaultParameter(final String variableName, final String value)
{
super(variableName, value);
}
/**
* If {@link #getValue()} is {@link Constants#DELETE}, the list of default parameters is deleted. Else, it stores a
* default parameter.
*/
@Override
public void execute(final Context> context)
{
// Resolve values
super.resolveValues(context);
// Get the appropriate storage
final DuplicateStorage storage = context.getDefaultParameters();
// If the value is not "delete"
if (!value.equals(Constants.DELETE))
{
// Store the default parameter
storage.store(variableName, value);
XltLogger.runTimeLogger.debug("Added \"" + variableName + "\" with the value \"" + value + "\" to default parameter storage");
}
else
{
// If the variableName is Constants.PARAMETERS, then we delete all default parameters
if (variableName.equals(Constants.PARAMETERS))
{
storage.clear();
XltLogger.runTimeLogger.debug("Removed all default parameters");
}
// else we simply delete the specified parameters
else
{
storage.remove(variableName);
XltLogger.runTimeLogger.debug("Removed \"" + variableName + "\" from default parameter storage");
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy