Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 85a26d6

Browse files
committed
Fixed up the multiple doctor actors being one doctor bug (around John Hurt)
1 parent 828078c commit 85a26d6

File tree

4 files changed

+18
-15
lines changed

4 files changed

+18
-15
lines changed

src/main/java/org/neo4j/tutorial/DoctorWhoUniverseGenerator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ private void createDatabaseCache( String currentDbDir ) throws IOException
6060

6161
private boolean cachedDatabaseExists()
6262
{
63-
return cachedCleanDatabaseDirectory.exists() && cachedCleanDatabaseDirectory.isDirectory();
63+
return false; // for debugging
64+
// return cachedCleanDatabaseDirectory.exists() && cachedCleanDatabaseDirectory.isDirectory();
6465
}
6566

6667
private String copyDatabaseFromCachedDirectoryToTempDirectory() throws IOException

src/main/java/org/neo4j/tutorial/EpisodeBuilder.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
package org.neo4j.tutorial;
22

33
import java.util.ArrayList;
4-
import java.util.Collections;
54
import java.util.List;
65

76
import org.neo4j.cypher.ExecutionEngine;
87

98
import static java.lang.String.format;
9+
import static java.util.Collections.addAll;
1010

1111
import static org.neo4j.tutorial.ShortIdGenerator.shortId;
1212

1313
public class EpisodeBuilder
1414
{
15-
1615
private String title;
1716
private List<String> companionNames = new ArrayList<>();
1817
private String episodeNumber = null;
@@ -53,25 +52,25 @@ public EpisodeBuilder title( String title )
5352

5453
public EpisodeBuilder doctor( String... actorNames )
5554
{
56-
Collections.addAll( doctorActors, actorNames );
55+
addAll( doctorActors, actorNames );
5756
return this;
5857
}
5958

6059
public EpisodeBuilder companion( String... namesOfCompanions )
6160
{
62-
Collections.addAll( companionNames, namesOfCompanions );
61+
addAll( companionNames, namesOfCompanions );
6362
return this;
6463
}
6564

6665
public EpisodeBuilder enemySpecies( String... enemySpecies )
6766
{
68-
Collections.addAll( this.enemySpecies, enemySpecies );
67+
addAll( this.enemySpecies, enemySpecies );
6968
return this;
7069
}
7170

7271
public EpisodeBuilder enemy( String... enemies )
7372
{
74-
Collections.addAll( this.enemies, enemies );
73+
addAll( this.enemies, enemies );
7574
return this;
7675
}
7776

@@ -229,13 +228,13 @@ public EpisodeBuilder allies( String... allies )
229228

230229
public EpisodeBuilder alliedSpecies( String... alliedSpecies )
231230
{
232-
Collections.addAll( this.alliedSpecies, alliedSpecies );
231+
addAll( this.alliedSpecies, alliedSpecies );
233232
return this;
234233
}
235234

236235
public EpisodeBuilder others( String... others )
237236
{
238-
Collections.addAll( this.others, others );
237+
addAll( this.others, others );
239238
return this;
240239
}
241240

src/main/java/org/neo4j/tutorial/Episodes.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,18 +144,18 @@ private void season34()
144144
.others( "War Doctor" )
145145
.fact( engine );
146146
episode( "Special" ).title( "The Night of the Doctor" )
147-
.doctor( "Paul McGann, John Hurt" )
147+
.doctor( "Paul McGann", "John Hurt" )
148148
.allies( "Sisterhood of Karn" )
149149
.others( "War Doctor" )
150150
.fact( engine );
151151
episode( 240 ).title( "The Day of the Doctor" )
152-
.doctor( "David Tennant, Matt Smith, John Hurt" )
152+
.doctor( "David Tennant", "Matt Smith", "John Hurt" )
153153
.companion( "Clara Oswald" )
154154
.enemySpecies( "Zygon" )
155155
.others( "War Doctor" )
156156
.fact( engine );
157157
episode( 241 ).title( "The Time of the Doctor" )
158-
.doctor( "Matt Smith, Peter Capaldi" )
158+
.doctor( "Matt Smith", "Peter Capaldi" )
159159
.companion( "Clara Oswald" )
160160
.allies( "Tasha Lem" )
161161
.enemySpecies( "Cyberman", "Dalek" )

src/main/java/org/neo4j/tutorial/server/ServerBuilder.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import java.util.Properties;
99

1010
import org.neo4j.helpers.collection.MapUtil;
11+
import org.neo4j.kernel.configuration.Config;
12+
import org.neo4j.kernel.logging.ClassicLoggingService;
1113
import org.neo4j.server.CommunityNeoServer;
1214
import org.neo4j.server.configuration.Configurator;
1315
import org.neo4j.server.configuration.PropertyFileConfigurator;
@@ -16,6 +18,8 @@
1618
import org.neo4j.server.database.CommunityDatabase;
1719
import org.neo4j.server.database.Database;
1820

21+
import static org.neo4j.kernel.logging.ConsoleLogger.DEV_NULL;
22+
1923
public class ServerBuilder
2024
{
2125
private String portNo = "7474";
@@ -45,13 +49,12 @@ public CommunityNeoServer build() throws IOException
4549
}
4650
File configFile = createPropertiesFiles();
4751

48-
return new CommunityNeoServer(
49-
new PropertyFileConfigurator( new Validator( new DatabaseLocationMustBeSpecifiedRule() ), configFile ) )
52+
return new CommunityNeoServer( new PropertyFileConfigurator( new Validator( new DatabaseLocationMustBeSpecifiedRule() ), configFile, DEV_NULL), new ClassicLoggingService( new Config( ) ) )
5053
{
5154
@Override
5255
protected Database createDatabase()
5356
{
54-
return new CommunityDatabase( configurator );
57+
return new CommunityDatabase( configurator, logging );
5558
}
5659
};
5760
}

0 commit comments

Comments
 (0)