Skip to content
This repository was archived by the owner on Jul 6, 2023. It is now read-only.

Commit 1876af7

Browse files
committed
Apply mono repo code style.
1 parent 9373120 commit 1876af7

File tree

121 files changed

+9277
-5334
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+9277
-5334
lines changed

config/checkstyle/checkstyle.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,12 @@
9797
<module name="GenericWhitespace"/>
9898
<module name="ExplicitInitialization"/>
9999

100+
<!-- Included in mono repo but not worth it to introduce here at this moment
100101
<module name="IllegalImport">
101102
<property name="illegalPkgs" value="junit.framework"/>
102103
</module>
104+
-->
105+
103106
<module name="LocalVariableName">
104107
<property name="allowOneCharVarInForLoop" value="true"/>
105108
</module>

cypher-shell/src/integration-test/java/org/neo4j/shell/MainIntegrationTest.java

Lines changed: 298 additions & 227 deletions
Large diffs are not rendered by default.
Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,45 @@
1+
/*
2+
* Copyright (c) 2002-2020 "Neo4j,"
3+
* Neo4j Sweden AB [http://neo4j.com]
4+
*
5+
* This file is part of Neo4j.
6+
*
7+
* Neo4j is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19+
*/
120
package org.neo4j.shell;
221

322
import org.neo4j.shell.prettyprint.LinePrinter;
423
import org.neo4j.shell.prettyprint.OutputFormatter;
524

6-
public class StringLinePrinter implements LinePrinter {
25+
public class StringLinePrinter implements LinePrinter
26+
{
727

828
private StringBuilder sb = new StringBuilder();
929

1030
@Override
11-
public void printOut(String line) {
12-
sb.append(line).append(OutputFormatter.NEWLINE);
31+
public void printOut( String line )
32+
{
33+
sb.append( line ).append( OutputFormatter.NEWLINE );
1334
}
1435

15-
public void clear() {
16-
sb.setLength(0);
36+
public void clear()
37+
{
38+
sb.setLength( 0 );
1739
}
1840

19-
public String output() {
41+
public String output()
42+
{
2043
return sb.toString();
2144
}
2245
}

cypher-shell/src/integration-test/java/org/neo4j/shell/commands/CypherShellFailureIntegrationTest.java

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
/*
2+
* Copyright (c) 2002-2020 "Neo4j,"
3+
* Neo4j Sweden AB [http://neo4j.com]
4+
*
5+
* This file is part of Neo4j.
6+
*
7+
* Neo4j is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19+
*/
120
package org.neo4j.shell.commands;
221

322
import org.junit.Before;
@@ -13,23 +32,26 @@
1332
import org.neo4j.shell.exception.CommandException;
1433
import org.neo4j.shell.prettyprint.PrettyConfig;
1534

16-
public class CypherShellFailureIntegrationTest extends CypherShellIntegrationTest {
35+
public class CypherShellFailureIntegrationTest extends CypherShellIntegrationTest
36+
{
1737
@Rule
1838
public final ExpectedException thrown = ExpectedException.none();
1939

2040
private StringLinePrinter linePrinter = new StringLinePrinter();
2141

2242
@Before
23-
public void setUp() {
43+
public void setUp()
44+
{
2445
linePrinter.clear();
25-
shell = new CypherShell(linePrinter, new PrettyConfig(Format.VERBOSE, true, 1000), false, new ShellParameterMap());
46+
shell = new CypherShell( linePrinter, new PrettyConfig( Format.VERBOSE, true, 1000 ), false, new ShellParameterMap() );
2647
}
2748

2849
@Test
29-
public void cypherWithNoPasswordShouldReturnValidError() throws CommandException {
30-
thrown.expect(AuthenticationException.class);
31-
thrown.expectMessage("The client is unauthorized due to authentication failure.");
50+
public void cypherWithNoPasswordShouldReturnValidError() throws CommandException
51+
{
52+
thrown.expect( AuthenticationException.class );
53+
thrown.expectMessage( "The client is unauthorized due to authentication failure." );
3254

33-
connect("");
55+
connect( "" );
3456
}
3557
}

cypher-shell/src/integration-test/java/org/neo4j/shell/commands/CypherShellIntegrationTest.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
/*
2+
* Copyright (c) 2002-2020 "Neo4j,"
3+
* Neo4j Sweden AB [http://neo4j.com]
4+
*
5+
* This file is part of Neo4j.
6+
*
7+
* Neo4j is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19+
*/
120
package org.neo4j.shell.commands;
221

322
import org.neo4j.shell.ConnectionConfig;
@@ -11,7 +30,8 @@ abstract class CypherShellIntegrationTest
1130
{
1231
CypherShell shell;
1332

14-
void connect(String password) throws CommandException {
33+
void connect( String password ) throws CommandException
34+
{
1535
shell.connect( new ConnectionConfig( "bolt", "localhost", 7687, "neo4j", password, Encryption.DEFAULT, ABSENT_DB_NAME ) );
1636
}
1737
}

cypher-shell/src/integration-test/java/org/neo4j/shell/commands/CypherShellMultiDatabaseIntegrationTest.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
/*
2+
* Copyright (c) 2002-2020 "Neo4j,"
3+
* Neo4j Sweden AB [http://neo4j.com]
4+
*
5+
* This file is part of Neo4j.
6+
*
7+
* Neo4j is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19+
*/
120
package org.neo4j.shell.commands;
221

322
import org.junit.After;
Lines changed: 56 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
/*
2+
* Copyright (c) 2002-2020 "Neo4j,"
3+
* Neo4j Sweden AB [http://neo4j.com]
4+
*
5+
* This file is part of Neo4j.
6+
*
7+
* Neo4j is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19+
*/
120
package org.neo4j.shell.commands;
221

322
import org.junit.After;
@@ -16,72 +35,74 @@
1635

1736
import static org.hamcrest.CoreMatchers.containsString;
1837
import static org.hamcrest.MatcherAssert.assertThat;
19-
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
20-
import static org.junit.Assume.assumeThat;
21-
import static org.junit.Assert.assertEquals;
2238
import static org.neo4j.shell.prettyprint.OutputFormatter.NEWLINE;
23-
import static org.neo4j.shell.util.Versions.version;
2439

25-
public class CypherShellPlainIntegrationTest extends CypherShellIntegrationTest {
40+
public class CypherShellPlainIntegrationTest extends CypherShellIntegrationTest
41+
{
2642
@Rule
2743
public final ExpectedException thrown = ExpectedException.none();
2844

2945
private StringLinePrinter linePrinter = new StringLinePrinter();
3046

3147
@Before
32-
public void setUp() throws Exception {
48+
public void setUp() throws Exception
49+
{
3350
linePrinter.clear();
34-
shell = new CypherShell(linePrinter, new PrettyConfig(Format.PLAIN, true, 1000), false, new ShellParameterMap());
51+
shell = new CypherShell( linePrinter, new PrettyConfig( Format.PLAIN, true, 1000 ), false, new ShellParameterMap() );
3552
connect( "neo" );
3653
}
3754

3855
@After
39-
public void tearDown() throws Exception {
40-
shell.execute("MATCH (n) DETACH DELETE (n)");
56+
public void tearDown() throws Exception
57+
{
58+
shell.execute( "MATCH (n) DETACH DELETE (n)" );
4159
}
4260

4361
@Test
44-
public void periodicCommitWorks() throws CommandException {
45-
shell.execute("USING PERIODIC COMMIT\n" +
46-
"LOAD CSV FROM 'https://neo4j.com/docs/cypher-refcard/3.2/csv/artists.csv' AS line\n" +
47-
"CREATE (:Artist {name: line[1], year: toInteger(line[2])});");
62+
public void periodicCommitWorks() throws CommandException
63+
{
64+
shell.execute( "USING PERIODIC COMMIT\n" +
65+
"LOAD CSV FROM 'https://neo4j.com/docs/cypher-refcard/3.2/csv/artists.csv' AS line\n" +
66+
"CREATE (:Artist {name: line[1], year: toInteger(line[2])});" );
4867
linePrinter.clear();
4968

50-
shell.execute("MATCH (a:Artist) WHERE a.name = 'Europe' RETURN a.name");
69+
shell.execute( "MATCH (a:Artist) WHERE a.name = 'Europe' RETURN a.name" );
5170

52-
assertThat(linePrinter.output(), containsString("a.name"+ NEWLINE+"\"Europe\""));
71+
assertThat( linePrinter.output(), containsString( "a.name" + NEWLINE + "\"Europe\"" ) );
5372
}
5473

5574
@Test
56-
public void cypherWithProfileStatements() throws CommandException {
75+
public void cypherWithProfileStatements() throws CommandException
76+
{
5777
//when
58-
shell.execute("CYPHER RUNTIME=INTERPRETED PROFILE RETURN null");
78+
shell.execute( "CYPHER RUNTIME=INTERPRETED PROFILE RETURN null" );
5979

6080
//then
6181
String actual = linePrinter.output();
6282
// This assertion checks everything except for time and cypher
63-
assertThat(actual, containsString("Plan: \"PROFILE\""));
64-
assertThat(actual, containsString("Statement: \"READ_ONLY\""));
65-
assertThat(actual, containsString("Planner: \"COST\""));
66-
assertThat(actual, containsString("Runtime: \"INTERPRETED\""));
67-
assertThat(actual, containsString("DbHits: 0"));
68-
assertThat(actual, containsString("Rows: 1"));
69-
assertThat(actual, containsString("null"));
70-
assertThat(actual, containsString("NULL"));
83+
assertThat( actual, containsString( "Plan: \"PROFILE\"" ) );
84+
assertThat( actual, containsString( "Statement: \"READ_ONLY\"" ) );
85+
assertThat( actual, containsString( "Planner: \"COST\"" ) );
86+
assertThat( actual, containsString( "Runtime: \"INTERPRETED\"" ) );
87+
assertThat( actual, containsString( "DbHits: 0" ) );
88+
assertThat( actual, containsString( "Rows: 1" ) );
89+
assertThat( actual, containsString( "null" ) );
90+
assertThat( actual, containsString( "NULL" ) );
7191
}
7292

7393
@Test
74-
public void cypherWithExplainStatements() throws CommandException {
94+
public void cypherWithExplainStatements() throws CommandException
95+
{
7596
//when
76-
shell.execute("CYPHER RUNTIME=INTERPRETED EXPLAIN RETURN null");
97+
shell.execute( "CYPHER RUNTIME=INTERPRETED EXPLAIN RETURN null" );
7798

7899
//then
79100
String actual = linePrinter.output();
80101
// This assertion checks everything except for time and cypher
81-
assertThat(actual, containsString("Plan: \"EXPLAIN\""));
82-
assertThat(actual, containsString("Statement: \"READ_ONLY\""));
83-
assertThat(actual, containsString("Planner: \"COST\""));
84-
assertThat(actual, containsString("Runtime: \"INTERPRETED\""));
102+
assertThat( actual, containsString( "Plan: \"EXPLAIN\"" ) );
103+
assertThat( actual, containsString( "Statement: \"READ_ONLY\"" ) );
104+
assertThat( actual, containsString( "Planner: \"COST\"" ) );
105+
assertThat( actual, containsString( "Runtime: \"INTERPRETED\"" ) );
85106
}
86107

87108
@Test
@@ -90,15 +111,15 @@ public void shouldUseParamFromCLIArgs() throws EvaluationException, CommandExcep
90111
// given a CLI arg
91112
ShellParameterMap parameterMap = new ShellParameterMap();
92113
parameterMap.setParameter( "foo", "'bar'" );
93-
shell = new CypherShell( linePrinter, new PrettyConfig( Format.PLAIN, true, 1000), false, parameterMap );
114+
shell = new CypherShell( linePrinter, new PrettyConfig( Format.PLAIN, true, 1000 ), false, parameterMap );
94115
connect( "neo" );
95116

96117
//when
97-
shell.execute("CYPHER RETURN $foo");
118+
shell.execute( "CYPHER RETURN $foo" );
98119

99120
//then
100121
String actual = linePrinter.output();
101-
assertThat(actual, containsString("$foo"));
102-
assertThat(actual, containsString("bar"));
122+
assertThat( actual, containsString( "$foo" ) );
123+
assertThat( actual, containsString( "bar" ) );
103124
}
104125
}

0 commit comments

Comments
 (0)