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

Commit 6f06c36

Browse files
committed
Apply mono repo code style.
1 parent bb83d8f commit 6f06c36

File tree

127 files changed

+9539
-5434
lines changed

Some content is hidden

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

127 files changed

+9539
-5434
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: 313 additions & 235 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: 62 additions & 36 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;
@@ -21,83 +40,90 @@
2140
import static org.neo4j.shell.prettyprint.OutputFormatter.NEWLINE;
2241
import static org.neo4j.shell.util.Versions.version;
2342

24-
public class CypherShellPlainIntegrationTest extends CypherShellIntegrationTest {
43+
public class CypherShellPlainIntegrationTest extends CypherShellIntegrationTest
44+
{
2545
@Rule
2646
public final ExpectedException thrown = ExpectedException.none();
2747

2848
private StringLinePrinter linePrinter = new StringLinePrinter();
2949

3050
@Before
31-
public void setUp() throws Exception {
51+
public void setUp() throws Exception
52+
{
3253
linePrinter.clear();
33-
shell = new CypherShell(linePrinter, new PrettyConfig(Format.PLAIN, true, 1000), false, new ShellParameterMap());
54+
shell = new CypherShell( linePrinter, new PrettyConfig( Format.PLAIN, true, 1000 ), false, new ShellParameterMap() );
3455
connect( "neo" );
3556
}
3657

3758
@After
38-
public void tearDown() throws Exception {
39-
shell.execute("MATCH (n) DETACH DELETE (n)");
59+
public void tearDown() throws Exception
60+
{
61+
shell.execute( "MATCH (n) DETACH DELETE (n)" );
4062
}
4163

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

49-
shell.execute("MATCH (a:Artist) WHERE a.name = 'Europe' RETURN a.name");
72+
shell.execute( "MATCH (a:Artist) WHERE a.name = 'Europe' RETURN a.name" );
5073

51-
assertThat(linePrinter.output(), containsString("a.name"+ NEWLINE+"\"Europe\""));
74+
assertThat( linePrinter.output(), containsString( "a.name" + NEWLINE + "\"Europe\"" ) );
5275
}
5376

5477
@Test
55-
public void cypherWithProfileStatements() throws CommandException {
78+
public void cypherWithProfileStatements() throws CommandException
79+
{
5680
//when
57-
shell.execute("CYPHER RUNTIME=INTERPRETED PROFILE RETURN null");
81+
shell.execute( "CYPHER RUNTIME=INTERPRETED PROFILE RETURN null" );
5882

5983
//then
6084
String actual = linePrinter.output();
6185
// This assertion checks everything except for time and cypher
62-
assertThat(actual, containsString("Plan: \"PROFILE\""));
63-
assertThat(actual, containsString("Statement: \"READ_ONLY\""));
64-
assertThat(actual, containsString("Planner: \"COST\""));
65-
assertThat(actual, containsString("Runtime: \"INTERPRETED\""));
66-
assertThat(actual, containsString("DbHits: 0"));
67-
assertThat(actual, containsString("Rows: 1"));
68-
assertThat(actual, containsString("null"));
69-
assertThat(actual, containsString("NULL"));
86+
assertThat( actual, containsString( "Plan: \"PROFILE\"" ) );
87+
assertThat( actual, containsString( "Statement: \"READ_ONLY\"" ) );
88+
assertThat( actual, containsString( "Planner: \"COST\"" ) );
89+
assertThat( actual, containsString( "Runtime: \"INTERPRETED\"" ) );
90+
assertThat( actual, containsString( "DbHits: 0" ) );
91+
assertThat( actual, containsString( "Rows: 1" ) );
92+
assertThat( actual, containsString( "null" ) );
93+
assertThat( actual, containsString( "NULL" ) );
7094
}
7195

7296
@Test
73-
public void cypherWithProfileWithMemory() throws CommandException {
97+
public void cypherWithProfileWithMemory() throws CommandException
98+
{
7499
// given
75100

76101
String serverVersion = shell.getServerVersion();
77102
// Memory profile are only available from 4.1
78-
assumeThat( version(serverVersion), greaterThanOrEqualTo(version("4.1")));
103+
assumeThat( version( serverVersion ), greaterThanOrEqualTo( version( "4.1" ) ) );
79104

80105
//when
81-
shell.execute("CYPHER RUNTIME=INTERPRETED PROFILE RETURN null");
106+
shell.execute( "CYPHER RUNTIME=INTERPRETED PROFILE RETURN null" );
82107

83108
//then
84109
String actual = linePrinter.output();
85-
System.out.println(actual);
86-
assertThat(actual, containsString("Memory (Bytes): 0"));
110+
System.out.println( actual );
111+
assertThat( actual, containsString( "Memory (Bytes): 0" ) );
87112
}
88113

89114
@Test
90-
public void cypherWithExplainStatements() throws CommandException {
115+
public void cypherWithExplainStatements() throws CommandException
116+
{
91117
//when
92-
shell.execute("CYPHER RUNTIME=INTERPRETED EXPLAIN RETURN null");
118+
shell.execute( "CYPHER RUNTIME=INTERPRETED EXPLAIN RETURN null" );
93119

94120
//then
95121
String actual = linePrinter.output();
96122
// This assertion checks everything except for time and cypher
97-
assertThat(actual, containsString("Plan: \"EXPLAIN\""));
98-
assertThat(actual, containsString("Statement: \"READ_ONLY\""));
99-
assertThat(actual, containsString("Planner: \"COST\""));
100-
assertThat(actual, containsString("Runtime: \"INTERPRETED\""));
123+
assertThat( actual, containsString( "Plan: \"EXPLAIN\"" ) );
124+
assertThat( actual, containsString( "Statement: \"READ_ONLY\"" ) );
125+
assertThat( actual, containsString( "Planner: \"COST\"" ) );
126+
assertThat( actual, containsString( "Runtime: \"INTERPRETED\"" ) );
101127
}
102128

103129
@Test
@@ -106,15 +132,15 @@ public void shouldUseParamFromCLIArgs() throws EvaluationException, CommandExcep
106132
// given a CLI arg
107133
ShellParameterMap parameterMap = new ShellParameterMap();
108134
parameterMap.setParameter( "foo", "'bar'" );
109-
shell = new CypherShell( linePrinter, new PrettyConfig( Format.PLAIN, true, 1000), false, parameterMap );
135+
shell = new CypherShell( linePrinter, new PrettyConfig( Format.PLAIN, true, 1000 ), false, parameterMap );
110136
connect( "neo" );
111137

112138
//when
113-
shell.execute("CYPHER RETURN $foo");
139+
shell.execute( "CYPHER RETURN $foo" );
114140

115141
//then
116142
String actual = linePrinter.output();
117-
assertThat(actual, containsString("$foo"));
118-
assertThat(actual, containsString("bar"));
143+
assertThat( actual, containsString( "$foo" ) );
144+
assertThat( actual, containsString( "bar" ) );
119145
}
120146
}

0 commit comments

Comments
 (0)