Skip to content

[WIP] PR for testing danger #533

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ language: java
# @todo #1034 Travis CI: run tests on PostgreSQL
env:
matrix:
- SPRING_PROFILES_ACTIVE=test
#- SPRING_PROFILES_ACTIVE=test
- SPRING_PROFILES_ACTIVE=travis
global:
- MAVEN_OPTS='-Xss256k'
Expand Down
2 changes: 2 additions & 0 deletions expected-rflint.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
+ src/test/robotframework/selenium.utils.robot
E: 65, 0: Line has trailing whitespace (TrailingWhitespace)
1 change: 1 addition & 0 deletions expected-shellcheck.log
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/main/scripts/ci/deploy.sh:28:9: note: Double quote to prevent globbing and word splitting. [SC2086]
3 changes: 3 additions & 0 deletions expected-validator.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ERROR:html5validator.validator:"file:src/main/webapp/WEB-INF/views/participant/add.html":172.3-172.12: info warning: Element name "th:block" cannot be represented as XML 1.0.
"file:src/main/webapp/WEB-INF/views/participant/add.html":172.3-172.12: error: Element "th:block" not allowed as child of element "body" in this context. (Suppressing further errors from this subtree.)
"file:src/main/webapp/WEB-INF/views/site/events.html":15.2-15.8: error: Element "head" is missing a required instance of child element "title".
18 changes: 12 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@

<dependencies>

<dependency>
<groupId>com.github.heneke.thymeleaf</groupId>
<artifactId>thymeleaf-extras-togglz</artifactId>
<version>${thymeleaf.togglz.version}</version>
</dependency>

<!-- Required for InternetAddress class -->
<dependency>
<groupId>com.sun.mail</groupId>
Expand All @@ -35,6 +29,12 @@
<version>${thumbnailator.version}</version>
</dependency>

<dependency>
<groupId>com.github.heneke.thymeleaf</groupId>
<artifactId>thymeleaf-extras-togglz</artifactId>
<version>${thymeleaf.togglz.version}</version>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
Expand Down Expand Up @@ -415,6 +415,12 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>

<dependency>
<groupId>org.togglz</groupId>
<artifactId>togglz-testing</artifactId>
Expand Down
7 changes: 0 additions & 7 deletions src/main/config/spotbugs-filter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,6 @@
<Class name="ru.mystamps.web.feature.series.DownloadResult" />
<Bug pattern="EI_EXPOSE_REP" />
</Match>
<Match>
<!--
It's ok, that we're don't override parent's equals() method.
-->
<Class name="ru.mystamps.web.support.spring.security.CustomUserDetails" />
<Bug pattern="EQ_DOESNT_OVERRIDE_EQUALS" />
</Match>
<Match>
<!--
I don't care about a serialVersionUID field.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.util.Date;
import java.util.Locale;

import static ru.mystamps.web.feature.account.UserDetails.Role.ADMIN;
import static ru.mystamps.web.feature.account.UserDetails.Role.USER;

@RequiredArgsConstructor
Expand Down Expand Up @@ -69,7 +70,7 @@ public void registerUser(ActivateAccountDto dto) {

AddUserDbDto user = new AddUserDbDto();
user.setLogin(login);
user.setRole(USER);
//user.setRole(USER);
user.setName(finalName);
user.setEmail(email);
user.setRegisteredAt(registrationDate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ public class CategoryController {

@InitBinder("addCategoryForm")
protected void initBinder(WebDataBinder binder) {
// We can't use StringTrimmerEditor here because "only one single registered custom
// editor per property path is supported".
// We can't use StringTrimmerEditor here because "only one single registered custom editor per property path is supported".
ReplaceRepeatingSpacesEditor editor = new ReplaceRepeatingSpacesEditor(true);
binder.registerCustomEditor(String.class, "name", editor);
binder.registerCustomEditor(String.class, "nameRu", editor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
*/
package ru.mystamps.web.feature.country;

import javax.validation.Valid;

import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
Expand All @@ -32,7 +34,6 @@
import ru.mystamps.web.support.spring.mvc.ReplaceRepeatingSpacesEditor;
import ru.mystamps.web.support.spring.security.CurrentUser;

import javax.validation.Valid;
import java.util.List;
import java.util.Locale;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@
import java.util.Map;

// FIXME: move stamps related methods to separate interface (#88)
@SuppressWarnings({
"PMD.AvoidDuplicateLiterals",
"PMD.TooManyMethods",
"PMD.TooManyFields",
"PMD.LongVariable"
})
@RequiredArgsConstructor
public class JdbcSeriesDao implements SeriesDao {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
/*
* Copyright (C) 2009-2019 Slava Semushin <slava.semushin@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package ru.mystamps.web.feature.series.importing;

@SuppressWarnings("PMD.CommentDefaultAccessModifier")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public AdminDailyReport getDailyReport() {

report.setAddedSeriesCounter(seriesService.countAddedSince(yesterday));
report.setUpdatedSeriesCounter(seriesService.countUpdatedSince(yesterday));
report.setUpdatedCollectionsCounter(collectionService.countUpdatedSince(yesterday));
//report.setUpdatedCollectionsCounter(collectionService.countUpdatedSince(yesterday));
report.setRegistrationRequestsCounter(usersActivationService.countCreatedSince(yesterday));
report.setRegisteredUsersCounter(userService.countRegisteredSince(yesterday));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public class SiteServiceImpl implements SiteService {
private final SuspiciousActivityDao suspiciousActivities;

@Override
@SuppressWarnings("PMD.UseObjectForClearerAPI")
@Async
@Transactional
public void logAboutAbsentPage(
Expand All @@ -61,7 +60,6 @@ public void logAboutAbsentPage(
}

@Override
@SuppressWarnings("PMD.UseObjectForClearerAPI")
@Transactional
public void logAboutFailedAuthentication(
String page,
Expand Down
3 changes: 3 additions & 0 deletions src/main/javascript/series/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
// IMPORTANT:
// You must update ResourceUrl.RESOURCES_VERSION each time whenever you're modified this file!
//
function exampleFunction() {
// do nothing
}

function initPage(suggestCategoryUrl, suggestCountryUrl) {
$('#country').selectize();
Expand Down
5 changes: 0 additions & 5 deletions src/main/scripts/ci/check-build-and-verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,7 @@ if [ "$RUN_ONLY_INTEGRATION_TESTS" = 'no' ]; then
if [ "$RFLINT_STATUS" != 'skip' ]; then
rflint \
--error=all \
--ignore TooFewTestSteps \
--ignore TooManyTestSteps \
--ignore TooFewKeywordSteps \
--ignore TooManyTestCases \
--ignore RequireTestDocumentation \
--ignore RequireKeywordDocumentation \
--configure LineTooLong:130 \
src/test/robotframework \
>rflint.log 2>&1 || RFLINT_STATUS=fail
Expand Down
2 changes: 1 addition & 1 deletion src/main/scripts/ci/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ trap 'cleanup' EXIT SIGHUP SIGINT SIGTERM
# See: http://docs.ansible.com/ansible/intro_getting_started.html#host-key-checking
export ANSIBLE_HOST_KEY_CHECKING=False

if [ -z "${encrypted_bf07cb25089f_key:-}" ] || [ -z "${encrypted_bf07cb25089f_iv:-}" ] ; then
if [ -z ${encrypted_bf07cb25089f_key:-} ] || [ -z "${encrypted_bf07cb25089f_iv:-}" ] ; then
echo >&2 'ERROR: encrypted_bf07cb25089f_key or encrypted_bf07cb25089f_iv were not defined!'
exit 1
fi
Expand Down
4 changes: 4 additions & 0 deletions src/main/webapp/WEB-INF/static/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
}
*/

#some-element {
color: red;
}

body,
#user_bar ul {
margin: 0;
Expand Down
2 changes: 2 additions & 0 deletions src/main/webapp/WEB-INF/views/participant/add.html
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,10 @@ <h3 th:text="${#strings.capitalize(header)}">
</div>

<!-- Placed at the end of the document so the pages load faster -->
<th:block>
<script src="http://yandex.st/jquery/1.9.1/jquery.min.js" th:src="${JQUERY_JS}"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" th:src="${BOOTSTRAP_JS}"></script>
<script src="../../../../javascript/participant/add.js" th:src="${PARTICIPANT_ADD_JS}"></script>
</th:block>
</body>
</html>
1 change: 1 addition & 0 deletions src/main/webapp/WEB-INF/views/series/add.html
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ <h3 th:text="${#strings.capitalize(add_series)}">
<div class="col-sm-7">
<input id="image"
type="file"
class="form-control"
style="box-shadow: none; border: 0px;"
accept="image/png,image/jpeg"
th:field="*{uploadedImage}"
Expand Down
1 change: 1 addition & 0 deletions src/main/webapp/WEB-INF/views/series/info.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
<div class="col-sm-9">
<input id="image"
type="file"
class="form-control"
style="box-shadow: none; border: 0px;"
accept="image/png,image/jpeg"
th:field="*{uploadedImage}"
Expand Down
63 changes: 30 additions & 33 deletions src/main/webapp/WEB-INF/views/site/events.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="robots" content="noindex" />
<title th:text="|#{t_my_stamps}: #{t_suspicious_activities}|">My stamps: suspicious activities</title>
<link rel="shortcut icon" type="image/x-icon" href="../../../favicon.ico" th:href="${FAVICON_ICO}" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" th:href="${BOOTSTRAP_CSS}" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/usrz/bootstrap-languages@3ac2a3d2b27ac43a471cd99e79d378a03b2c6b5f/languages.min.css" th:href="${BOOTSTRAP_LANGUAGE}" />
Expand Down Expand Up @@ -158,38 +157,36 @@ <h3 class="text-center" th:text="${#strings.capitalize(suspicious_activities)}">
</div>

<div th:if="${not #lists.isEmpty(activities)}" class="row text-center">
<div class="col-sm-12">
<nav>
<ul class="pagination">
<li class="disabled" th:class="${pager.prev == null}? 'disabled'">
<span aria-hidden="true" th:if="${pager.prev == null}">&laquo;</span>
<!--/*/
<a href="#" aria-label="Previous"
th:if="${pager.prev != null}"
th:href="@{${SITE_EVENTS_PAGE}(page=${pager.prev})}">
<span aria-hidden="true">&laquo;</span>
</a>
/*/-->
</li>
<li class="active" th:each="item : ${pager.items}" th:class="${item == pager.currentPage}? 'active'">
<a href="#" th:href="@{${SITE_EVENTS_PAGE}(page=${item})}"
th:utext="|${item} &lt;span class='sr-only'&gt;(current)&lt;/span&gt;|">
1 <span class="sr-only">(current)</span>
</a>
</li>
<li class="disabled" th:class="${pager.next == null}? 'disabled'">
<span aria-hidden="true" th:if="${pager.next == null}">&raquo;</span>
<!--/*/
<a href="#" aria-label="Next"
th:if="${pager.next != null}"
th:href="@{${SITE_EVENTS_PAGE}(page=${pager.next})}">
<span aria-hidden="true">&raquo;</span>
</a>
/*/-->
</li>
</ul>
</nav>
</div>
<nav>
<ul class="pagination">
<li class="disabled" th:class="${pager.prev == null}? 'disabled'">
<span aria-hidden="true" th:if="${pager.prev == null}">&laquo;</span>
<!--/*/
<a href="#" aria-label="Previous"
th:if="${pager.prev != null}"
th:href="@{${SITE_EVENTS_PAGE}(page=${pager.prev})}">
<span aria-hidden="true">&laquo;</span>
</a>
/*/-->
</li>
<li class="active" th:each="item : ${pager.items}" th:class="${item == pager.currentPage}? 'active'">
<a href="#" th:href="@{${SITE_EVENTS_PAGE}(page=${item})}"
th:utext="|${item} &lt;span class='sr-only'&gt;(current)&lt;/span&gt;|">
1 <span class="sr-only">(current)</span>
</a>
</li>
<li class="disabled" th:class="${pager.next == null}? 'disabled'">
<span aria-hidden="true" th:if="${pager.next == null}">&raquo;</span>
<!--/*/
<a href="#" aria-label="Next"
th:if="${pager.next != null}"
th:href="@{${SITE_EVENTS_PAGE}(page=${pager.next})}">
<span aria-hidden="true">&raquo;</span>
</a>
/*/-->
</li>
</ul>
</nav>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class CollectionServiceImplTest extends Specification {
@SuppressWarnings(['ClosureAsLastMethodParameter', 'FactoryMethodName', 'UnnecessaryReturnKeyword'])
def 'createCollection() should assign updated at to current date'() {
when:
service.createCollection(Random.userId(), 'any-login')
service.createCollection(Random.userId(), "any-login")
then:
1 * collectionDao.add({ AddCollectionDbDto collection ->
assert DateUtils.roughlyEqual(collection?.updatedAt, new Date())
Expand Down
6 changes: 3 additions & 3 deletions src/test/javascript/CatalogUtilsSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ describe("CatalogUtils.expandNumbers()", function() {
});

it("should return string without hyphen as is", function() {
expect(CatalogUtils.expandNumbers("test")).toEqual("test");
expect(CatalogUtils.expandNumbers("test")).toEqual("2test");
});

it("should return 'one-two' for 'one-two'", function() {
expect(CatalogUtils.expandNumbers("one-two")).toEqual("one-two");
expect(CatalogUtils.expandNumbers("one-two")).toEqual("one two");
});

it("should return '1,2' for '1-2'", function() {
Expand Down Expand Up @@ -81,7 +81,7 @@ describe("CatalogUtils.expandNumbers()", function() {
});

it("should return '1,2,3' for '1/3'", function() {
expect(CatalogUtils.expandNumbers("1/3")).toEqual("1,2,3");
expect(CatalogUtils.expandNumbers("1/3")).toEqual("1,2");
});

it("should return '1,2,3,4,5,6' for '1/3, 4-6'", function() {
Expand Down
2 changes: 1 addition & 1 deletion src/test/robotframework/category/creation/logic.robot
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Create category with name in English and Russian
Input Text id:nameRu Космос
Submit Form id:add-category-form
Location Should Be ${SITE_URL}/category/space
Element Text Should Be id:page-header Space
Element Text Should Be id:page-header Space!
Go To ${SITE_URL}/category/space?lang=ru
Element Text Should Be id:page-header Космос

Expand Down
2 changes: 1 addition & 1 deletion src/test/robotframework/selenium.utils.robot
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Wait Until Element Value Is

Select Random Option From List
[Documentation] Choose a random option from a select element
[Arguments] ${locator}
[Arguments] ${locator}
${options}= Get List Items ${locator}
${size}= Get Length ${options}
${randomIndex}= Evaluate random.randint(0, ${size}-1) modules=random
Expand Down
2 changes: 1 addition & 1 deletion src/test/robotframework/series/access.robot
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Anonymous user cannot create series
Element Text Should Be id:error-msg Forbidden

Opening a page of non-existing series show an error
Go To ${SITE_URL}/series/999
Go To ${SITE_URL}/series/1
Element Text Should Be id:error-code 404
Element Text Should Match Regexp id:error-msg Requested page[\\n\\r]+not found

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Suite Teardown Close Browser
Force Tags series search logic

*** Test Cases ***
Search series by non-existing catalog number
Search series by non-existing catalog number
Input Text id:catalogNumber 888
Select Random Option From List id:catalogName
Submit Form id:search-series-form
Expand Down