You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jmeter.apache.org by Philippe Mouawad <ph...@gmail.com> on 2016/03/18 21:25:07 UTC
Re: svn commit: r1735575 - in /jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser:
NotReusableParser.java ReusableParser.java TestBaseParser.java
Thanks Felix !
On Fri, Mar 18, 2016 at 12:17 PM, <fs...@apache.org> wrote:
> Author: fschumacher
> Date: Fri Mar 18 11:17:47 2016
> New Revision: 1735575
>
> URL: http://svn.apache.org/viewvc?rev=1735575&view=rev
> Log:
> Unittests for BaseParser.
>
> Added:
>
> jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/NotReusableParser.java
> (with props)
>
> jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/ReusableParser.java
> (with props)
>
> jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestBaseParser.java
> (with props)
>
> Added:
> jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/NotReusableParser.java
> URL:
> http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/NotReusableParser.java?rev=1735575&view=auto
>
> ==============================================================================
> ---
> jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/NotReusableParser.java
> (added)
> +++
> jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/NotReusableParser.java
> Fri Mar 18 11:17:47 2016
> @@ -0,0 +1,43 @@
> +/*
> + * 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.jmeter.protocol.http.parser;
> +
> +import java.net.URL;
> +import java.util.Iterator;
> +
> +import org.apache.commons.lang3.NotImplementedException;
> +
> +/**
> + * Test class, that implements an dummy {@link LinkExtractorParser} that
> is not
> + * reusable
> + */
> +public class NotReusableParser implements LinkExtractorParser {
> +
> + @Override
> + public Iterator<URL> getEmbeddedResourceURLs(String userAgent,
> + byte[] responseData, URL baseUrl, String encoding)
> + throws LinkExtractorParseException {
> + throw new NotImplementedException("Test class");
> + }
> +
> + @Override
> + public boolean isReusable() {
> + return false;
> + }
> +
> +}
>
> Propchange:
> jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/NotReusableParser.java
>
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Added:
> jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/ReusableParser.java
> URL:
> http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/ReusableParser.java?rev=1735575&view=auto
>
> ==============================================================================
> ---
> jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/ReusableParser.java
> (added)
> +++
> jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/ReusableParser.java
> Fri Mar 18 11:17:47 2016
> @@ -0,0 +1,43 @@
> +/*
> + * 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.jmeter.protocol.http.parser;
> +
> +import java.net.URL;
> +import java.util.Iterator;
> +
> +import org.apache.commons.lang3.NotImplementedException;
> +
> +/**
> + * Test class, that implements an dummy {@link LinkExtractorParser} that
> is
> + * reusable
> + */
> +public class ReusableParser implements LinkExtractorParser {
> +
> + @Override
> + public Iterator<URL> getEmbeddedResourceURLs(String userAgent,
> + byte[] responseData, URL baseUrl, String encoding)
> + throws LinkExtractorParseException {
> + throw new NotImplementedException("Test class");
> + }
> +
> + @Override
> + public boolean isReusable() {
> + return true;
> + }
> +
> +}
> \ No newline at end of file
>
> Propchange:
> jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/ReusableParser.java
>
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Added:
> jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestBaseParser.java
> URL:
> http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestBaseParser.java?rev=1735575&view=auto
>
> ==============================================================================
> ---
> jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestBaseParser.java
> (added)
> +++
> jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestBaseParser.java
> Fri Mar 18 11:17:47 2016
> @@ -0,0 +1,42 @@
> +/*
> + * 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.jmeter.protocol.http.parser;
> +
> +import static org.junit.Assert.*;
> +
> +import org.junit.Test;
> +
> +public class TestBaseParser {
> +
> + @Test
> + public void testReusableCache() throws Exception {
> + LinkExtractorParser parser = BaseParser
> + .getParser(ReusableParser.class.getCanonicalName());
> + assertSame(parser, BaseParser.getParser(ReusableParser.class
> + .getCanonicalName()));
> + }
> +
> + @Test
> + public void testNotReusableCache() throws Exception{
> + LinkExtractorParser parser = BaseParser
> + .getParser(NotReusableParser.class.getCanonicalName());
> + assertNotSame(parser, BaseParser.getParser(NotReusableParser.class
> + .getCanonicalName()));
> + }
> +
> +}
>
> Propchange:
> jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestBaseParser.java
>
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
>
>
--
Cordialement.
Philippe Mouawad.