Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* JBoss, Home of Professional Open Source
* Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors
* as indicated by the @authors tag. All rights reserved.
* See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* 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 org.jboss.arquillian.config.impl.extension;
import java.util.HashSet;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.jboss.arquillian.config.descriptor.api.ArquillianDescriptor;
/**
* Add/Override arquillian.xml based on SystemProperties.
*
* arq.container.[qualifier].mode
* arq.container.[qualifier].default
* arq.container.[qualifier].configuration.[property_name]
* arq.container.[qualifier].protocol.[type].[property_name]
*
* arq.group.[qualifier].default
* arq.group.[qualifier].container.[qualifier].configuration.[property_name]
* arq.group.[qualifier].container.[qualifier].protocol.[type].[property_name]
*
* arq.extension.[qualifier].[property_name]
*
* arq.defaultprotocol.[type]
* arq.defaultprotocol.[type].[property_name]
*
* arq.engine.[property_name]
*
* @author Aslak Knutsen
* @version $Revision: $
*/
public class PropertiesParser
{
private static String ARQ_PROPERTY = "arq\\..*";
private static String ARQ_ENGINE_PROPERTY = "arq\\.engine\\.(.*)";
private static String ARQ_CONTAINER = "arq\\.container\\.(.*)\\.(.*)";
private static String ARQ_CONTAINER_CONFIGURATION = "arq\\.container\\.(.*)\\.configuration\\.(.*)";
private static String ARQ_CONTAINER_PROTOCOL = "arq\\.container\\.(.*)\\.protocol\\.(.*)\\.(.*)";
private static String ARQ_GROUP = "arq\\.group\\.(.*)\\.(.*)";
private static String ARQ_GROUP_CONTAINER = "arq\\.group\\.(.*)\\.container\\.(.*)\\.(.*)";
private static String ARQ_GROUP_CONTAINER_CONFIGURATION = "arq\\.group\\.(.*)\\.container\\.(.*)\\.configuration\\.(.*)";
private static String ARQ_GROUP_CONTAINER_PROTOCOL = "arq\\.group\\.(.*)\\.container\\.(.*)\\.protocol\\.(.*)\\.(.*)";
private static String ARQ_DEFAULT_PROTOCOL = "arq\\.defaultprotocol\\.(.*)\\.(.*)";
private static String ARQ_EXTENSION = "arq\\.extension\\.(.*)\\.(.*)";
private Handler[] handlers = new Handler[]{
new EngineProperty(ARQ_ENGINE_PROPERTY),
new ContainerConfiguration(ARQ_CONTAINER_CONFIGURATION),
new ContainerProtocol(ARQ_CONTAINER_PROTOCOL),
new Container(ARQ_CONTAINER),
new Extension(ARQ_EXTENSION),
new GroupContainerConfiguration(ARQ_GROUP_CONTAINER_CONFIGURATION),
new GroupContainerProtocol(ARQ_GROUP_CONTAINER_PROTOCOL),
new GroupContainer(ARQ_GROUP_CONTAINER),
new Group(ARQ_GROUP),
new DefaultProtocol(ARQ_DEFAULT_PROTOCOL)
};
public void addProperties(ArquillianDescriptor descriptor, Properties properties)
{
if(descriptor == null)
{
throw new IllegalArgumentException("Descriptor must be specified");
}
if(properties == null)
{
throw new IllegalArgumentException("Properties must be specified");
}
Set> filteredProps = filterProperties(properties);
for(Entry