<commit_before>/**
 * Copyright 2007 <NAME>
 *
 * 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 net.hillsdon.reviki.web.common;

import junit.framework.TestCase;
import net.hillsdon.reviki.configuration.DeploymentConfiguration;
import net.hillsdon.reviki.configuration.PerWikiInitialConfiguration;

/**
 * Test for {@link RequestBasedWikiUrls}.
 * 
 * @author mth
 */
public class TestRequestBasedWikiUrls extends TestCase {

  private DeploymentConfiguration _configuration;
  private MockHttpServletRequest _request;

  @Override
  protected void setUp() throws Exception {
    _configuration = null;
    _request = new MockHttpServletRequest();
    _request.setContextPath("/svnwiki");
    _request.setRequestURL("http://www.example.com/svnwiki/some/page");
    _request.setRequestURI("/svnwiki/some/page");
  }
  

  public void testNullWiki() {
    RequestBasedWikiUrls urls = new RequestBasedWikiUrls(_request, new PerWikiInitialConfiguration(_configuration, null, "foo"));
    assertEquals("http://www.example.com/svnwiki/pages/", urls.root());
    assertEquals("http://www.example.com/svnwiki/pages/Spaced+Out", urls.page("Spaced Out"));
    assertEquals("http://www.example.com/svnwiki/pages/RecentChanges/atom.xml", urls.feed());
    assertEquals("http://www.example.com/svnwiki/pages/FindPage", urls.search());
  }

  public void testGivenNameWiki() {
    RequestBasedWikiUrls urls = new RequestBasedWikiUrls(_request, new PerWikiInitialConfiguration(_configuration, "foo", "foo"));
    assertEquals("http://www.example.com/svnwiki/pages/foo/", urls.root());
    assertEquals("http://www.example.com/svnwiki/pages/foo/Spaced+Out", urls.page("Spaced Out"));
    assertEquals("http://www.example.com/svnwiki/pages/foo/RecentChanges/atom.xml", urls.feed());
    assertEquals("http://www.example.com/svnwiki/pages/foo/FindPage", urls.search());
  }
  
}<commit_msg>More rename.<commit_after>/**
 * Copyright 2007 <NAME>
 *
 * 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 net.hillsdon.reviki.web.common;

import junit.framework.TestCase;
import net.hillsdon.reviki.configuration.DeploymentConfiguration;
import net.hillsdon.reviki.configuration.PerWikiInitialConfiguration;

/**
 * Test for {@link RequestBasedWikiUrls}.
 * 
 * @author mth
 */
public class TestRequestBasedWikiUrls extends TestCase {

  private DeploymentConfiguration _configuration;
  private MockHttpServletRequest _request;

  @Override
  protected void setUp() throws Exception {
    _configuration = null;
    _request = new MockHttpServletRequest();
    _request.setContextPath("/reviki");
    _request.setRequestURL("http://www.example.com/reviki/some/page");
    _request.setRequestURI("/reviki/some/page");
  }
  

  public void testNullWiki() {
    RequestBasedWikiUrls urls = new RequestBasedWikiUrls(_request, new PerWikiInitialConfiguration(_configuration, null, "foo"));
    assertEquals("http://www.example.com/reviki/pages/", urls.root());
    assertEquals("http://www.example.com/reviki/pages/Spaced+Out", urls.page("Spaced Out"));
    assertEquals("http://www.example.com/reviki/pages/RecentChanges/atom.xml", urls.feed());
    assertEquals("http://www.example.com/reviki/pages/FindPage", urls.search());
  }

  public void testGivenNameWiki() {
    RequestBasedWikiUrls urls = new RequestBasedWikiUrls(_request, new PerWikiInitialConfiguration(_configuration, "foo", "foo"));
    assertEquals("http://www.example.com/reviki/pages/foo/", urls.root());
    assertEquals("http://www.example.com/reviki/pages/foo/Spaced+Out", urls.page("Spaced Out"));
    assertEquals("http://www.example.com/reviki/pages/foo/RecentChanges/atom.xml", urls.feed());
    assertEquals("http://www.example.com/reviki/pages/foo/FindPage", urls.search());
  }
  
}
{'fraction_non_alphanumeric': 0.1281459731543624, 'fraction_numerical': 0.003355704697986577, 'mean_word_length': 4.64378698224852, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 20, 'xml': 4}, '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': '6439622', 'n_tokens_mistral': 1404, 'n_tokens_neox': 1379, 'n_words': 323}