<commit_before><commit_msg>Move to more suitable package name<commit_after>// $Header$
/*
 * Copyright 2001-2004 The Apache Software Foundation.
 *
 * 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.apache.jmeter.junit.protocol.http.config;

import org.apache.jmeter.config.Arguments;
import org.apache.jmeter.junit.JMeterTestCase;
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase;
import org.apache.jmeter.protocol.http.sampler.HTTPNullSampler;
import org.apache.jmeter.testelement.property.JMeterProperty;
import org.apache.jmeter.testelement.property.NullProperty;
import org.apache.jmeter.testelement.property.TestElementProperty;

/**
 * @author <NAME>
 * @version $Revision$
 */
public class UrlConfigTest extends JMeterTestCase {
	HTTPSamplerBase config;

	HTTPSamplerBase defaultConfig;

	HTTPSamplerBase partialConfig;

	public UrlConfigTest(String name) {
		super(name);
	}

	protected void setUp() {
		Arguments args = new Arguments();
		args.addArgument("username", "mstover");
		args.addArgument("password", "<PASSWORD>");
		args.addArgument("action", "login");
		config = new HTTPNullSampler();
		config.setName("Full Config");
		config.setProperty(HTTPSamplerBase.DOMAIN, "www.lazer.com");
		config.setProperty(HTTPSamplerBase.PATH, "login.jsp");
		config.setProperty(HTTPSamplerBase.METHOD, HTTPSamplerBase.POST);
		config.setProperty(new TestElementProperty(HTTPSamplerBase.ARGUMENTS, args));
		defaultConfig = new HTTPNullSampler();
		defaultConfig.setName("default");
		defaultConfig.setProperty(HTTPSamplerBase.DOMAIN, "www.xerox.com");
		defaultConfig.setProperty(HTTPSamplerBase.PATH, "default.html");
		partialConfig = new HTTPNullSampler();
		partialConfig.setProperty(HTTPSamplerBase.PATH, "main.jsp");
		partialConfig.setProperty(HTTPSamplerBase.METHOD, HTTPSamplerBase.GET);
	}

	public void testSimpleConfig() {
		assertTrue(config.getName().equals("Full Config"));
		assertEquals(config.getDomain(), "www.lazer.com");
	}

	public void testOverRide() {
		JMeterProperty jmp = partialConfig.getProperty(HTTPSamplerBase.DOMAIN);
		assertTrue(jmp instanceof NullProperty);
		assertTrue(new NullProperty(HTTPSamplerBase.DOMAIN).equals(jmp));
		partialConfig.addTestElement(defaultConfig);
		assertEquals(partialConfig.getPropertyAsString(HTTPSamplerBase.DOMAIN), "www.xerox.com");
		assertEquals(partialConfig.getPropertyAsString(HTTPSamplerBase.PATH), "main.jsp");
	}
}
{'fraction_non_alphanumeric': 0.11361310133060389, 'fraction_numerical': 0.0040941658137154556, 'mean_word_length': 5.866510538641686, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 5, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1463598', 'n_tokens_mistral': 906, 'n_tokens_neox': 874, 'n_words': 191}