Skip to content

Commit f586a58

Browse files
authored
Merge pull request #105 from ldbc/dev
Release 0.3.2
2 parents a023a8f + 42c7640 commit f586a58

22 files changed

+117
-182
lines changed

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>com.ldbc.driver</groupId>
77
<artifactId>jeeves</artifactId>
8-
<version>0.3.1</version>
8+
<version>0.3.2</version>
99
<packaging>jar</packaging>
1010

1111
<name>LDBC Driver</name>

src/main/java/com/ldbc/driver/control/DriverConfigurationFileHelper.java

+7-50
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,15 @@
1616

1717
public class DriverConfigurationFileHelper
1818
{
19-
private static final String CONFIGURATION_DIR_NAME = "configuration";
20-
2119
public static void main( String[] args ) throws IOException, DriverConfigurationException
2220
{
23-
updateDefaultConfigurationFiles();
21+
File baseConfigurationFilePublicLocation = new File( args[0] );
22+
updateDefaultConfigurationFiles(baseConfigurationFilePublicLocation);
2423
print();
2524
}
2625

27-
private static void updateDefaultConfigurationFiles() throws DriverConfigurationException, IOException
26+
private static void updateDefaultConfigurationFiles(File baseConfigurationFilePublicLocation) throws DriverConfigurationException, IOException
2827
{
29-
File driverRootDirectory = getDriverRootDirectory();
30-
31-
File baseConfigurationFilePublicLocation = getBaseConfigurationFilePublicLocation( driverRootDirectory );
3228
createBaseConfigurationAt( baseConfigurationFilePublicLocation );
3329
if ( !readConfigurationFileAt( baseConfigurationFilePublicLocation ).equals( baseConfiguration() ) )
3430
{
@@ -88,7 +84,7 @@ private static ConsoleAndFileDriverConfiguration readConfigurationFileAt( File c
8884
ldbcDriverDefaultConfigurationProperties.load( new FileInputStream( configurationFile ) );
8985
Map<String,String> ldbcDriverDefaultConfigurationAsParamsMap =
9086
ConsoleAndFileDriverConfiguration.convertLongKeysToShortKeys(
91-
MapUtils.<String,String>propertiesToMap( ldbcDriverDefaultConfigurationProperties )
87+
MapUtils.propertiesToMap( ldbcDriverDefaultConfigurationProperties )
9288
);
9389

9490
if ( !ldbcDriverDefaultConfigurationAsParamsMap
@@ -98,30 +94,10 @@ private static ConsoleAndFileDriverConfiguration readConfigurationFileAt( File c
9894
return ConsoleAndFileDriverConfiguration.fromParamsMap( ldbcDriverDefaultConfigurationAsParamsMap );
9995
}
10096

101-
static File getBaseConfigurationFilePublicLocation() throws DriverConfigurationException
102-
{
103-
return getBaseConfigurationFilePublicLocation( getDriverRootDirectory() );
104-
}
105-
106-
public static File getWorkloadsDirectory() throws DriverConfigurationException
97+
static File getBaseConfigurationFilePublicLocation()
10798
{
108-
File rootDirectory = getDriverRootDirectory();
109-
return getWorkloadsDirectory( rootDirectory );
110-
}
111-
112-
public static File getWorkloadsDirectory( File driverRootDirectory ) throws DriverConfigurationException
113-
{
114-
File workloadsDirectory = new File( driverRootDirectory, CONFIGURATION_DIR_NAME );
115-
if ( !workloadsDirectory.exists() )
116-
{
117-
throw new DriverConfigurationException(
118-
"Directory does not exist: " + workloadsDirectory.getAbsolutePath() );
119-
}
120-
if ( !workloadsDirectory.isDirectory() )
121-
{
122-
throw new DriverConfigurationException( "Not a directory: " + workloadsDirectory.getAbsolutePath() );
123-
}
124-
return workloadsDirectory;
99+
return org.apache.commons.io.FileUtils.toFile(
100+
DriverConfigurationFileHelper.class.getResource( "/configuration/ldbc_driver_default.properties" ));
125101
}
126102

127103
private static ConsoleAndFileDriverConfiguration baseConfiguration() throws DriverConfigurationException
@@ -131,23 +107,4 @@ private static ConsoleAndFileDriverConfiguration baseConfiguration() throws Driv
131107
long operationCount = 0;
132108
return ConsoleAndFileDriverConfiguration.fromDefaults( databaseClassName, workloadClassName, operationCount );
133109
}
134-
135-
private static File getDriverRootDirectory()
136-
{
137-
File resourcesDirectory = FileUtils.toFile( DriverConfigurationFileHelper.class.getResource( "/" ) );
138-
File targetDirectory = resourcesDirectory.getParentFile();
139-
return targetDirectory.getParentFile();
140-
}
141-
142-
private static File getBaseConfigurationFilePublicLocation( File driverRootDirectory )
143-
throws DriverConfigurationException
144-
{
145-
File workloadsDirectory = new File( driverRootDirectory, CONFIGURATION_DIR_NAME );
146-
if ( !workloadsDirectory.exists() )
147-
{
148-
throw new DriverConfigurationException(
149-
"Directory does not exist: " + workloadsDirectory.getAbsolutePath() );
150-
}
151-
return new File( workloadsDirectory, "ldbc_driver_default.properties" );
152-
}
153110
}

src/main/java/com/ldbc/driver/workloads/ldbc/snb/bi/LdbcSnbBiWorkloadConfiguration.java

+15-26
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
package com.ldbc.driver.workloads.ldbc.snb.bi;
22

33
import com.google.common.collect.Lists;
4+
import com.google.common.collect.Maps;
45
import com.ldbc.driver.Operation;
56
import com.ldbc.driver.WorkloadException;
67
import com.ldbc.driver.control.ConsoleAndFileDriverConfiguration;
7-
import com.ldbc.driver.control.DriverConfigurationException;
8-
import com.ldbc.driver.control.DriverConfigurationFileHelper;
98
import com.ldbc.driver.util.ClassLoaderHelper;
109
import com.ldbc.driver.util.ClassLoadingException;
11-
import com.ldbc.driver.util.MapUtils;
10+
import com.ldbc.driver.workloads.ldbc.snb.interactive.LdbcSnbInteractiveWorkloadConfiguration;
1211

13-
import java.io.File;
1412
import java.io.IOException;
13+
import java.io.InputStream;
1514
import java.util.HashMap;
1615
import java.util.HashSet;
1716
import java.util.List;
1817
import java.util.Map;
18+
import java.util.Properties;
1919
import java.util.Set;
2020

2121
import static com.ldbc.driver.util.FileUtils.removePrefix;
@@ -656,33 +656,22 @@ private LdbcSnbBiInterleaves(
656656
}
657657
}
658658

659-
public static File defaultConfigFileSF1() throws DriverConfigurationException
659+
public static Map<String,String> defaultConfigSF1() throws IOException
660660
{
661-
return defaultConfigFileSF1FromWorkloadsDirectory(
662-
DriverConfigurationFileHelper.getWorkloadsDirectory()
663-
);
664-
}
665-
666-
public static File defaultConfigFileSF1( File driverRootDirectory ) throws DriverConfigurationException
667-
{
668-
return defaultConfigFileSF1FromWorkloadsDirectory(
669-
DriverConfigurationFileHelper.getWorkloadsDirectory( driverRootDirectory )
661+
String filename = "/configuration/ldbc/snb/bi/ldbc_snb_bi_SF-0001.properties";
662+
return ConsoleAndFileDriverConfiguration.convertLongKeysToShortKeys(
663+
resourceToMap( filename )
670664
);
671665
}
672666

673-
private static File defaultConfigFileSF1FromWorkloadsDirectory( File workloadsDirectory )
674-
throws DriverConfigurationException
675-
{
676-
return new File( workloadsDirectory, "ldbc/snb/bi/ldbc_snb_bi_SF-0001.properties" );
677-
}
678-
679-
public static Map<String,String> defaultConfigSF1() throws DriverConfigurationException, IOException
667+
private static Map<String,String> resourceToMap( String filename ) throws IOException
680668
{
681-
return ConsoleAndFileDriverConfiguration.convertLongKeysToShortKeys(
682-
MapUtils.loadPropertiesToMap(
683-
defaultConfigFileSF1()
684-
)
685-
);
669+
try ( InputStream inputStream = LdbcSnbInteractiveWorkloadConfiguration.class.getResource( filename ).openStream() )
670+
{
671+
Properties properties = new Properties();
672+
properties.load( inputStream );
673+
return new HashMap<>( Maps.fromProperties( properties ) );
674+
}
686675
}
687676

688677
public static Map<Integer,Class<? extends Operation>> operationTypeToClassMapping()

src/main/java/com/ldbc/driver/workloads/ldbc/snb/interactive/LdbcQuery2.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -122,17 +122,17 @@ public List<LdbcQuery2Result> marshalResult( String serializedResults ) throws S
122122
long personId = ((Number) resultAsList.get( 0 )).longValue();
123123
String personFirstName = (String) resultAsList.get( 1 );
124124
String personLastName = (String) resultAsList.get( 2 );
125-
long postOrCommentId = ((Number) resultAsList.get( 3 )).longValue();
126-
String postOrCommentContent = (String) resultAsList.get( 4 );
127-
long postOrCommentCreationDate = ((Number) resultAsList.get( 5 )).longValue();
125+
long messageId = ((Number) resultAsList.get( 3 )).longValue();
126+
String messageContent = (String) resultAsList.get( 4 );
127+
long messageCreationDate = ((Number) resultAsList.get( 5 )).longValue();
128128

129129
results.add( new LdbcQuery2Result(
130130
personId,
131131
personFirstName,
132132
personLastName,
133-
postOrCommentId,
134-
postOrCommentContent,
135-
postOrCommentCreationDate
133+
messageId,
134+
messageContent,
135+
messageCreationDate
136136
) );
137137
}
138138

@@ -151,9 +151,9 @@ public String serializeResult( Object resultsObject ) throws SerializingMarshall
151151
resultFields.add( result.personId() );
152152
resultFields.add( result.personFirstName() );
153153
resultFields.add( result.personLastName() );
154-
resultFields.add( result.postOrCommentId() );
155-
resultFields.add( result.postOrCommentContent() );
156-
resultFields.add( result.postOrCommentCreationDate() );
154+
resultFields.add( result.messageId() );
155+
resultFields.add( result.messageContent() );
156+
resultFields.add( result.messageCreationDate() );
157157
resultsFields.add( resultFields );
158158
}
159159

src/main/java/com/ldbc/driver/workloads/ldbc/snb/interactive/LdbcQuery2Result.java

+19-19
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ public class LdbcQuery2Result {
44
private final long personId;
55
private final String personFirstName;
66
private final String personLastName;
7-
private final long postOrCommentId;
8-
private final String postOrCommentContent;
9-
private final long postOrCommentCreationDate;
7+
private final long messageId;
8+
private final String messageContent;
9+
private final long messageCreationDate;
1010

11-
public LdbcQuery2Result(long personId, String personFirstName, String personLastName, long postOrCommentId, String postOrCommentContent, long postOrCommentCreationDate) {
11+
public LdbcQuery2Result(long personId, String personFirstName, String personLastName, long messageId, String messageContent, long messageCreationDate) {
1212
this.personId = personId;
1313
this.personFirstName = personFirstName;
1414
this.personLastName = personLastName;
15-
this.postOrCommentId = postOrCommentId;
16-
this.postOrCommentContent = postOrCommentContent;
17-
this.postOrCommentCreationDate = postOrCommentCreationDate;
15+
this.messageId = messageId;
16+
this.messageContent = messageContent;
17+
this.messageCreationDate = messageCreationDate;
1818
}
1919

2020
public long personId() {
@@ -29,16 +29,16 @@ public String personLastName() {
2929
return personLastName;
3030
}
3131

32-
public long postOrCommentId() {
33-
return postOrCommentId;
32+
public long messageId() {
33+
return messageId;
3434
}
3535

36-
public String postOrCommentContent() {
37-
return postOrCommentContent;
36+
public String messageContent() {
37+
return messageContent;
3838
}
3939

40-
public long postOrCommentCreationDate() {
41-
return postOrCommentCreationDate;
40+
public long messageCreationDate() {
41+
return messageCreationDate;
4242
}
4343

4444
@Override
@@ -49,13 +49,13 @@ public boolean equals(Object o) {
4949
LdbcQuery2Result result = (LdbcQuery2Result) o;
5050

5151
if (personId != result.personId) return false;
52-
if (postOrCommentCreationDate != result.postOrCommentCreationDate) return false;
53-
if (postOrCommentId != result.postOrCommentId) return false;
52+
if (messageCreationDate != result.messageCreationDate) return false;
53+
if (messageId != result.messageId) return false;
5454
if (personFirstName != null ? !personFirstName.equals(result.personFirstName) : result.personFirstName != null)
5555
return false;
5656
if (personLastName != null ? !personLastName.equals(result.personLastName) : result.personLastName != null)
5757
return false;
58-
if (postOrCommentContent != null ? !postOrCommentContent.equals(result.postOrCommentContent) : result.postOrCommentContent != null)
58+
if (messageContent != null ? !messageContent.equals(result.messageContent) : result.messageContent != null)
5959
return false;
6060

6161
return true;
@@ -67,9 +67,9 @@ public String toString() {
6767
"personId=" + personId +
6868
", personFirstName='" + personFirstName + '\'' +
6969
", personLastName='" + personLastName + '\'' +
70-
", postOrCommentId=" + postOrCommentId +
71-
", postOrCommentContent='" + postOrCommentContent + '\'' +
72-
", postOrCommentCreationDate=" + postOrCommentCreationDate +
70+
", messageId=" + messageId +
71+
", messageContent='" + messageContent + '\'' +
72+
", messageCreationDate=" + messageCreationDate +
7373
'}';
7474
}
7575
}

src/main/java/com/ldbc/driver/workloads/ldbc/snb/interactive/LdbcQuery7.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ public List<LdbcQuery7Result> marshalResult( String serializedResult ) throws Se
109109
String personFirstName = (String) row.get( 1 );
110110
String personLastName = (String) row.get( 2 );
111111
long likeCreationDate = ((Number) row.get( 3 )).longValue();
112-
long commentOrPostId = ((Number) row.get( 4 )).longValue();
113-
String commentOrPostContent = (String) row.get( 5 );
112+
long messageId = ((Number) row.get( 4 )).longValue();
113+
String messageContent = (String) row.get( 5 );
114114
int minutesLatency = ((Number) row.get( 6 )).intValue();
115115
boolean isNew = (Boolean) row.get( 7 );
116116

@@ -119,8 +119,8 @@ public List<LdbcQuery7Result> marshalResult( String serializedResult ) throws Se
119119
personFirstName,
120120
personLastName,
121121
likeCreationDate,
122-
commentOrPostId,
123-
commentOrPostContent,
122+
messageId,
123+
messageContent,
124124
minutesLatency,
125125
isNew
126126
) );
@@ -142,8 +142,8 @@ public String serializeResult( Object resultsObject ) throws SerializingMarshall
142142
resultFields.add( result.personFirstName() );
143143
resultFields.add( result.personLastName() );
144144
resultFields.add( result.likeCreationDate() );
145-
resultFields.add( result.commentOrPostId() );
146-
resultFields.add( result.commentOrPostContent() );
145+
resultFields.add( result.messageId() );
146+
resultFields.add( result.messageContent() );
147147
resultFields.add( result.minutesLatency() );
148148
resultFields.add( result.isNew() );
149149
resultsFields.add( resultFields );

src/main/java/com/ldbc/driver/workloads/ldbc/snb/interactive/LdbcQuery7Result.java

+14-14
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ public class LdbcQuery7Result {
55
private final String personFirstName;
66
private final String personLastName;
77
private final long likeCreationDate;
8-
private final long commentOrPostId;
9-
private final String commentOrPostContent;
8+
private final long messageId;
9+
private final String messageContent;
1010
private final int minutesLatency;
1111
private final boolean isNew;
1212

13-
public LdbcQuery7Result(long personId, String personFirstName, String personLastName, long likeCreationDate, long commentOrPostId, String commentOrPostContent, int minutesLatency, boolean isNew) {
13+
public LdbcQuery7Result(long personId, String personFirstName, String personLastName, long likeCreationDate, long messageId, String messageContent, int minutesLatency, boolean isNew) {
1414
this.personId = personId;
1515
this.personFirstName = personFirstName;
1616
this.personLastName = personLastName;
1717
this.likeCreationDate = likeCreationDate;
18-
this.commentOrPostId = commentOrPostId;
19-
this.commentOrPostContent = commentOrPostContent;
18+
this.messageId = messageId;
19+
this.messageContent = messageContent;
2020
this.minutesLatency = minutesLatency;
2121
this.isNew = isNew;
2222
}
@@ -37,12 +37,12 @@ public long likeCreationDate() {
3737
return likeCreationDate;
3838
}
3939

40-
public long commentOrPostId() {
41-
return commentOrPostId;
40+
public long messageId() {
41+
return messageId;
4242
}
4343

44-
public String commentOrPostContent() {
45-
return commentOrPostContent;
44+
public String messageContent() {
45+
return messageContent;
4646
}
4747

4848
public int minutesLatency() {
@@ -60,12 +60,12 @@ public boolean equals(Object o) {
6060

6161
LdbcQuery7Result that = (LdbcQuery7Result) o;
6262

63-
if (commentOrPostId != that.commentOrPostId) return false;
63+
if (messageId != that.messageId) return false;
6464
if (isNew != that.isNew) return false;
6565
if (likeCreationDate != that.likeCreationDate) return false;
6666
if (minutesLatency != that.minutesLatency) return false;
6767
if (personId != that.personId) return false;
68-
if (commentOrPostContent != null ? !commentOrPostContent.equals(that.commentOrPostContent) : that.commentOrPostContent != null)
68+
if (messageContent != null ? !messageContent.equals(that.messageContent) : that.messageContent != null)
6969
return false;
7070
if (personFirstName != null ? !personFirstName.equals(that.personFirstName) : that.personFirstName != null)
7171
return false;
@@ -82,10 +82,10 @@ public String toString() {
8282
", personFirstName='" + personFirstName + '\'' +
8383
", personLastName='" + personLastName + '\'' +
8484
", likeCreationDate=" + likeCreationDate +
85-
", commentOrPostId=" + commentOrPostId +
86-
", commentOrPostContent='" + commentOrPostContent + '\'' +
85+
", messageId=" + messageId +
86+
", messageContent='" + messageContent + '\'' +
8787
", minutesLatency=" + minutesLatency +
8888
", isNew=" + isNew +
8989
'}';
9090
}
91-
}
91+
}

0 commit comments

Comments
 (0)