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

Commit 852a849

Browse files
committed
Apply mono repo code style.
1 parent f3f2508 commit 852a849

File tree

110 files changed

+8209
-4623
lines changed

Some content is hidden

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

110 files changed

+8209
-4623
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>
Lines changed: 64 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,42 @@
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.junit.Before;
423
import org.junit.Test;
5-
import org.neo4j.shell.cli.CliArgs;
6-
import org.neo4j.shell.log.AnsiLogger;
7-
import org.neo4j.shell.log.Logger;
8-
import org.neo4j.shell.prettyprint.PrettyConfig;
924

1025
import java.io.ByteArrayInputStream;
1126
import java.io.ByteArrayOutputStream;
1227
import java.io.InputStream;
1328
import java.io.PrintStream;
1429

30+
import org.neo4j.shell.cli.CliArgs;
31+
import org.neo4j.shell.log.AnsiLogger;
32+
import org.neo4j.shell.log.Logger;
33+
import org.neo4j.shell.prettyprint.PrettyConfig;
34+
1535
import static org.junit.Assert.assertEquals;
1636
import static org.junit.Assert.assertTrue;
1737

18-
public class MainIntegrationTest {
38+
public class MainIntegrationTest
39+
{
1940

2041
private String inputString = String.format( "neo4j%nneo%n" );
2142
private ByteArrayOutputStream baos;
@@ -26,82 +47,87 @@ public class MainIntegrationTest {
2647
private InputStream inputStream;
2748

2849
@Before
29-
public void setup() {
50+
public void setup()
51+
{
3052
// given
31-
inputStream = new ByteArrayInputStream(inputString.getBytes());
53+
inputStream = new ByteArrayInputStream( inputString.getBytes() );
3254

3355
baos = new ByteArrayOutputStream();
34-
printStream = new PrintStream(baos);
56+
printStream = new PrintStream( baos );
3557

36-
main = new Main(inputStream, printStream);
58+
main = new Main( inputStream, printStream );
3759

3860
CliArgs cliArgs = new CliArgs();
39-
cliArgs.setUsername("", "");
40-
cliArgs.setPassword("", "");
61+
cliArgs.setUsername( "", "" );
62+
cliArgs.setPassword( "", "" );
4163

42-
Logger logger = new AnsiLogger(cliArgs.getDebugMode());
43-
PrettyConfig prettyConfig = new PrettyConfig(cliArgs);
64+
Logger logger = new AnsiLogger( cliArgs.getDebugMode() );
65+
PrettyConfig prettyConfig = new PrettyConfig( cliArgs );
4466
connectionConfig = new ConnectionConfig(
4567
cliArgs.getScheme(),
4668
cliArgs.getHost(),
4769
cliArgs.getPort(),
4870
cliArgs.getUsername(),
4971
cliArgs.getPassword(),
50-
cliArgs.getEncryption());
72+
cliArgs.getEncryption() );
5173

52-
shell = new CypherShell(logger, prettyConfig);
74+
shell = new CypherShell( logger, prettyConfig );
5375
}
5476

55-
5677
@Test
57-
public void promptsOnWrongAuthenticationIfInteractive() throws Exception {
78+
public void promptsOnWrongAuthenticationIfInteractive() throws Exception
79+
{
5880
// when
59-
assertEquals("", connectionConfig.username());
60-
assertEquals("", connectionConfig.password());
81+
assertEquals( "", connectionConfig.username() );
82+
assertEquals( "", connectionConfig.password() );
6183

62-
main.connectMaybeInteractively(shell, connectionConfig, true, true);
84+
main.connectMaybeInteractively( shell, connectionConfig, true, true );
6385

6486
// then
6587
// should be connected
66-
assertTrue(shell.isConnected());
88+
assertTrue( shell.isConnected() );
6789
// should have prompted and set the username and password
68-
assertEquals("neo4j", connectionConfig.username());
69-
assertEquals("neo", connectionConfig.password());
90+
assertEquals( "neo4j", connectionConfig.username() );
91+
assertEquals( "neo", connectionConfig.password() );
7092

7193
String out = baos.toString();
72-
assertEquals(String.format( "username: neo4j%npassword: ***%n" ), out);
94+
assertEquals( String.format( "username: neo4j%npassword: ***%n" ), out );
7395
}
7496

7597
@Test
76-
public void doesNotPromptToStdOutOnWrongAuthenticationIfOutputRedirected() throws Exception {
98+
public void doesNotPromptToStdOutOnWrongAuthenticationIfOutputRedirected() throws Exception
99+
{
77100
// when
78-
assertEquals("", connectionConfig.username());
79-
assertEquals("", connectionConfig.password());
101+
assertEquals( "", connectionConfig.username() );
102+
assertEquals( "", connectionConfig.password() );
80103

81104
// Redirect System.in and System.out
82105
InputStream stdIn = System.in;
83106
PrintStream stdOut = System.out;
84-
System.setIn(inputStream);
85-
System.setOut(printStream);
107+
System.setIn( inputStream );
108+
System.setOut( printStream );
86109

87110
// Create a Main with the standard in and out
88-
try {
111+
try
112+
{
89113
Main realMain = new Main();
90-
realMain.connectMaybeInteractively(shell, connectionConfig, true, false);
114+
realMain.connectMaybeInteractively( shell, connectionConfig, true, false );
91115

92116
// then
93117
// should be connected
94-
assertTrue(shell.isConnected());
118+
assertTrue( shell.isConnected() );
95119
// should have prompted silently and set the username and password
96-
assertEquals("neo4j", connectionConfig.username());
97-
assertEquals("neo", connectionConfig.password());
120+
assertEquals( "neo4j", connectionConfig.username() );
121+
assertEquals( "neo", connectionConfig.password() );
98122

99123
String out = baos.toString();
100-
assertEquals("", out);
101-
} finally {
124+
assertEquals( "", out );
125+
}
126+
finally
127+
{
102128
// Restore in and out
103-
System.setIn(stdIn);
104-
System.setOut(stdOut);
129+
System.setIn( stdIn );
130+
System.setOut( stdOut );
105131
}
106132
}
107133
}
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
}
Lines changed: 42 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,73 @@
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 static java.lang.String.format;
423

5-
@SuppressWarnings("WeakerAccess")
6-
public class Version implements Comparable<Version> {
24+
@SuppressWarnings( "WeakerAccess" )
25+
public class Version implements Comparable<Version>
26+
{
727
private final int major;
828
private final int minor;
929
private final int patch;
1030

11-
Version(int major, int minor, int patch) {
31+
Version( int major, int minor, int patch )
32+
{
1233
this.major = major;
1334
this.minor = minor;
1435
this.patch = patch;
1536
}
1637

17-
public int major() {
38+
public int major()
39+
{
1840
return major;
1941
}
2042

21-
public int minor() {
43+
public int minor()
44+
{
2245
return minor;
2346
}
2447

25-
public int patch() {
48+
public int patch()
49+
{
2650
return patch;
2751
}
2852

2953
@Override
30-
public int compareTo(Version o) {
31-
int comp = Integer.compare(major, o.major);
32-
if (comp == 0) {
33-
comp = Integer.compare(minor, o.minor);
34-
if (comp == 0) {
35-
comp = Integer.compare(patch, o.patch);
54+
public int compareTo( Version o )
55+
{
56+
int comp = Integer.compare( major, o.major );
57+
if ( comp == 0 )
58+
{
59+
comp = Integer.compare( minor, o.minor );
60+
if ( comp == 0 )
61+
{
62+
comp = Integer.compare( patch, o.patch );
3663
}
3764
}
3865
return comp;
3966
}
4067

4168
@Override
42-
public String toString() {
43-
return format("%d.%d.%d", major, minor, patch);
69+
public String toString()
70+
{
71+
return format( "%d.%d.%d", major, minor, patch );
4472
}
4573
}

0 commit comments

Comments
 (0)