com.xceptance.xlt.nocoding.util.Constants 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.util;
import java.util.HashSet;
import java.util.Set;
/**
* Has all important constants, that are used throughout parsing and executing.
*
* @author ckeiner
*/
public class Constants
{
public static final String ACTION = "Action";
public static final String REQUEST = "Request";
public static final String RESPONSE = "Response";
public static final String BODY = "Body";
public static final String STORE = "Store";
public static final String SUBREQUESTS = "Subrequests";
public static final String NAME = "Name";
public static final String URL = "Url";
public static final String METHOD = "Method";
public static final String ENCODEPARAMETERS = "Encode-Parameters";
public static final String ENCODEBODY = "Encode-Body";
public static final String XHR = "Xhr";
public static final String PARAMETERS = "Parameters";
public static final String HTTPCODE = "Httpcode";
public static final String VALIDATION = "Validate";
public static final String STATIC = "Static";
public static final String COOKIES = "Cookies";
public static final String HEADERS = "Headers";
public static final String DELETE = "Delete";
public static final String ENCODED = "Encoded";
public static final String METHOD_POST = "POST";
public static final String METHOD_GET = "GET";
public static final String METHOD_PUT = "PUT";
public static final String METHOD_DELETE = "DELETE";
public static final String METHOD_HEAD = "HEAD";
public static final String METHOD_TRACE = "TRACE";
public static final String METHOD_OPTIONS = "OPTIONS";
public static final String XPATH = "XPath";
public static final String REGEXP = "Regex";
public static final String TEXT = "Text";
public static final String GROUP = "Group";
public static final String HEADER = "Header";
public static final String COOKIE = "Cookie";
public static final String MATCHES = "Matches";
public static final String COUNT = "Count";
public static final String EXISTS = "Exists";
/**
* Supported list items:
*
* - {@link #ACTION}
*
- {@link #STORE}
*
- {@link #NAME}
*
- {@link #HTTPCODE}
*
- {@link #URL}
*
- {@link #METHOD}
*
- {@link #ENCODEPARAMETERS}
*
- {@link #ENCODEBODY}
*
- {@link #XHR}
*
- {@link #HEADERS}
*
- {@link #PARAMETERS}
*
- {@link #COOKIES}
*
- {@link #HEADER}
*
- {@link #BODY}
*
- {@link #STATIC}
*
*/
public final static Set PERMITTEDLISTITEMS = new HashSet<>();
/**
* Supported action items:
*
* - {@link #NAME}
*
- {@link #REQUEST}
*
- {@link #RESPONSE}
*
- {@link #SUBREQUESTS}
*
*/
public final static Set PERMITTEDACTIONITEMS = new HashSet<>();
/**
* Supported request items:
*
* - {@link #URL}
*
- {@link #METHOD}
*
- {@link #XHR}
*
- {@link #ENCODEPARAMETERS}
*
- {@link #PARAMETERS}
*
- {@link #HEADERS}
*
- {@link #BODY}
*
- {@link #ENCODEBODY}
*
*/
public final static Set PERMITTEDREQUESTITEMS = new HashSet<>();
/**
* Supported subrequest items:
*
* - {@link #XHR}
*
- {@link #STATIC}
*
*/
public final static Set PERMITTEDSUBREQUESTITEMS = new HashSet<>();
/**
* Supported response items:
*
* - {@link #HTTPCODE}
*
- {@link #VALIDATION}
*
- {@link #STORE}
*
*/
public final static Set PERMITTEDRESPONSEITEMS = new HashSet<>();
/**
* Supported selection modes:
*
* - {@link #XPATH}
*
- {@link #REGEXP}
*
- {@link #HEADER}
*
- {@link #COOKIE}
*
*/
public final static Set PERMITTEDEXTRACTIONMODE = new HashSet<>();
/**
* Supported validation modes:
*
* - {@link #TEXT}
*
- {@link #COUNT}
*
- {@link #MATCHES}
*
- {@link #EXISTS}
*
*/
public final static Set PERMITTEDVALIDATIONMETHOD = new HashSet<>();
static
{
PERMITTEDLISTITEMS.add(ACTION);
PERMITTEDLISTITEMS.add(STORE);
PERMITTEDLISTITEMS.add(NAME);
PERMITTEDLISTITEMS.add(HTTPCODE);
PERMITTEDLISTITEMS.add(URL);
PERMITTEDLISTITEMS.add(METHOD);
PERMITTEDLISTITEMS.add(XHR);
PERMITTEDLISTITEMS.add(ENCODEPARAMETERS);
PERMITTEDLISTITEMS.add(ENCODEBODY);
PERMITTEDLISTITEMS.add(HEADERS);
PERMITTEDLISTITEMS.add(PARAMETERS);
PERMITTEDLISTITEMS.add(COOKIES);
PERMITTEDLISTITEMS.add(HEADER);
PERMITTEDLISTITEMS.add(BODY);
PERMITTEDLISTITEMS.add(STATIC);
PERMITTEDACTIONITEMS.add(NAME);
PERMITTEDACTIONITEMS.add(REQUEST);
PERMITTEDACTIONITEMS.add(RESPONSE);
PERMITTEDACTIONITEMS.add(SUBREQUESTS);
PERMITTEDREQUESTITEMS.add(URL);
PERMITTEDREQUESTITEMS.add(METHOD);
PERMITTEDREQUESTITEMS.add(XHR);
PERMITTEDREQUESTITEMS.add(ENCODEPARAMETERS);
PERMITTEDREQUESTITEMS.add(PARAMETERS);
PERMITTEDREQUESTITEMS.add(COOKIES);
PERMITTEDREQUESTITEMS.add(HEADERS);
PERMITTEDREQUESTITEMS.add(BODY);
PERMITTEDREQUESTITEMS.add(ENCODEBODY);
PERMITTEDREQUESTITEMS.add(COOKIES);
PERMITTEDRESPONSEITEMS.add(HTTPCODE);
PERMITTEDRESPONSEITEMS.add(VALIDATION);
PERMITTEDRESPONSEITEMS.add(STORE);
PERMITTEDSUBREQUESTITEMS.add(XHR);
PERMITTEDSUBREQUESTITEMS.add(STATIC);
PERMITTEDEXTRACTIONMODE.add(XPATH);
PERMITTEDEXTRACTIONMODE.add(REGEXP);
PERMITTEDEXTRACTIONMODE.add(HEADER);
PERMITTEDEXTRACTIONMODE.add(COOKIE);
PERMITTEDVALIDATIONMETHOD.add(TEXT);
PERMITTEDVALIDATIONMETHOD.add(MATCHES);
PERMITTEDVALIDATIONMETHOD.add(COUNT);
PERMITTEDVALIDATIONMETHOD.add(EXISTS);
}
public static boolean isPermittedListItem(final String s)
{
return PERMITTEDLISTITEMS.contains(s);
}
public static boolean isPermittedActionItem(final String s)
{
return PERMITTEDACTIONITEMS.contains(s);
}
public static boolean isPermittedRequestItem(final String s)
{
return PERMITTEDREQUESTITEMS.contains(s);
}
public static boolean isPermittedResponseItem(final String s)
{
return PERMITTEDRESPONSEITEMS.contains(s);
}
public static boolean isPermittedSubRequestItem(final String s)
{
return PERMITTEDSUBREQUESTITEMS.contains(s);
}
public static boolean isPermittedExtraction(final String s)
{
return PERMITTEDEXTRACTIONMODE.contains(s);
}
public static boolean isPermittedValidationMethod(final String s)
{
return PERMITTEDVALIDATIONMETHOD.contains(s);
}
}