2 * SonarQube, open source software quality management tool.
3 * Copyright (C) 2008-2014 SonarSource
4 * mailto:contact AT sonarsource DOT com
6 * SonarQube is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 3 of the License, or (at your option) any later version.
11 * SonarQube is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 package org.sonar.server.db.migrations.v451;
22 import org.junit.ClassRule;
23 import org.junit.Test;
24 import org.sonar.core.persistence.TestDatabase;
25 import org.sonar.server.db.migrations.DatabaseMigration;
27 import static org.fest.assertions.Assertions.assertThat;
29 public class DeleteUnescapedActivitiesTest {
32 public static TestDatabase db = new TestDatabase().schema(DeleteUnescapedActivitiesTest.class, "schema.sql");
34 DatabaseMigration migration;
37 public void execute() throws Exception {
38 migration = new DeleteUnescapedActivities(db.database());
39 db.prepareDbUnit(getClass(), "execute.xml");
41 db.assertDbUnit(getClass(), "execute-result.xml", "activities");
45 public void is_unescaped() throws Exception {
46 assertThat(DeleteUnescapedActivities.isUnescaped(
47 "ruleKey=findbugs:PT_RELATIVE_PATH_TRAVERSAL;profileKey=java-findbugs-74105;severity=MAJOR;" +
48 "key=java-findbugs-74105:findbugs:PT_RELATIVE_PATH_TRAVERSAL"))
50 assertThat(DeleteUnescapedActivities.isUnescaped("param_xpath=/foo/bar")).isFalse();
51 assertThat(DeleteUnescapedActivities.isUnescaped("param_xpath=/foo/bar;foo;ruleKey=S001")).isTrue();
52 assertThat(DeleteUnescapedActivities.isUnescaped("param_xpath=/foo=foo;ruleKey=S001")).isTrue();