Skip to content

Commit

Permalink
Merge pull request #105 from ldbc/dev
Browse files Browse the repository at this point in the history
Release 0.3.2
  • Loading branch information
szarnyasg authored Dec 25, 2018
2 parents a023a8f + 42c7640 commit f586a58
Show file tree
Hide file tree
Showing 22 changed files with 117 additions and 182 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.ldbc.driver</groupId>
<artifactId>jeeves</artifactId>
<version>0.3.1</version>
<version>0.3.2</version>
<packaging>jar</packaging>

<name>LDBC Driver</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,15 @@

public class DriverConfigurationFileHelper
{
private static final String CONFIGURATION_DIR_NAME = "configuration";

public static void main( String[] args ) throws IOException, DriverConfigurationException
{
updateDefaultConfigurationFiles();
File baseConfigurationFilePublicLocation = new File( args[0] );
updateDefaultConfigurationFiles(baseConfigurationFilePublicLocation);
print();
}

private static void updateDefaultConfigurationFiles() throws DriverConfigurationException, IOException
private static void updateDefaultConfigurationFiles(File baseConfigurationFilePublicLocation) throws DriverConfigurationException, IOException
{
File driverRootDirectory = getDriverRootDirectory();

File baseConfigurationFilePublicLocation = getBaseConfigurationFilePublicLocation( driverRootDirectory );
createBaseConfigurationAt( baseConfigurationFilePublicLocation );
if ( !readConfigurationFileAt( baseConfigurationFilePublicLocation ).equals( baseConfiguration() ) )
{
Expand Down Expand Up @@ -88,7 +84,7 @@ private static ConsoleAndFileDriverConfiguration readConfigurationFileAt( File c
ldbcDriverDefaultConfigurationProperties.load( new FileInputStream( configurationFile ) );
Map<String,String> ldbcDriverDefaultConfigurationAsParamsMap =
ConsoleAndFileDriverConfiguration.convertLongKeysToShortKeys(
MapUtils.<String,String>propertiesToMap( ldbcDriverDefaultConfigurationProperties )
MapUtils.propertiesToMap( ldbcDriverDefaultConfigurationProperties )
);

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

static File getBaseConfigurationFilePublicLocation() throws DriverConfigurationException
{
return getBaseConfigurationFilePublicLocation( getDriverRootDirectory() );
}

public static File getWorkloadsDirectory() throws DriverConfigurationException
static File getBaseConfigurationFilePublicLocation()
{
File rootDirectory = getDriverRootDirectory();
return getWorkloadsDirectory( rootDirectory );
}

public static File getWorkloadsDirectory( File driverRootDirectory ) throws DriverConfigurationException
{
File workloadsDirectory = new File( driverRootDirectory, CONFIGURATION_DIR_NAME );
if ( !workloadsDirectory.exists() )
{
throw new DriverConfigurationException(
"Directory does not exist: " + workloadsDirectory.getAbsolutePath() );
}
if ( !workloadsDirectory.isDirectory() )
{
throw new DriverConfigurationException( "Not a directory: " + workloadsDirectory.getAbsolutePath() );
}
return workloadsDirectory;
return org.apache.commons.io.FileUtils.toFile(
DriverConfigurationFileHelper.class.getResource( "/configuration/ldbc_driver_default.properties" ));
}

private static ConsoleAndFileDriverConfiguration baseConfiguration() throws DriverConfigurationException
Expand All @@ -131,23 +107,4 @@ private static ConsoleAndFileDriverConfiguration baseConfiguration() throws Driv
long operationCount = 0;
return ConsoleAndFileDriverConfiguration.fromDefaults( databaseClassName, workloadClassName, operationCount );
}

private static File getDriverRootDirectory()
{
File resourcesDirectory = FileUtils.toFile( DriverConfigurationFileHelper.class.getResource( "/" ) );
File targetDirectory = resourcesDirectory.getParentFile();
return targetDirectory.getParentFile();
}

private static File getBaseConfigurationFilePublicLocation( File driverRootDirectory )
throws DriverConfigurationException
{
File workloadsDirectory = new File( driverRootDirectory, CONFIGURATION_DIR_NAME );
if ( !workloadsDirectory.exists() )
{
throw new DriverConfigurationException(
"Directory does not exist: " + workloadsDirectory.getAbsolutePath() );
}
return new File( workloadsDirectory, "ldbc_driver_default.properties" );
}
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
package com.ldbc.driver.workloads.ldbc.snb.bi;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.ldbc.driver.Operation;
import com.ldbc.driver.WorkloadException;
import com.ldbc.driver.control.ConsoleAndFileDriverConfiguration;
import com.ldbc.driver.control.DriverConfigurationException;
import com.ldbc.driver.control.DriverConfigurationFileHelper;
import com.ldbc.driver.util.ClassLoaderHelper;
import com.ldbc.driver.util.ClassLoadingException;
import com.ldbc.driver.util.MapUtils;
import com.ldbc.driver.workloads.ldbc.snb.interactive.LdbcSnbInteractiveWorkloadConfiguration;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;

import static com.ldbc.driver.util.FileUtils.removePrefix;
Expand Down Expand Up @@ -656,33 +656,22 @@ private LdbcSnbBiInterleaves(
}
}

public static File defaultConfigFileSF1() throws DriverConfigurationException
public static Map<String,String> defaultConfigSF1() throws IOException
{
return defaultConfigFileSF1FromWorkloadsDirectory(
DriverConfigurationFileHelper.getWorkloadsDirectory()
);
}

public static File defaultConfigFileSF1( File driverRootDirectory ) throws DriverConfigurationException
{
return defaultConfigFileSF1FromWorkloadsDirectory(
DriverConfigurationFileHelper.getWorkloadsDirectory( driverRootDirectory )
String filename = "/configuration/ldbc/snb/bi/ldbc_snb_bi_SF-0001.properties";
return ConsoleAndFileDriverConfiguration.convertLongKeysToShortKeys(
resourceToMap( filename )
);
}

private static File defaultConfigFileSF1FromWorkloadsDirectory( File workloadsDirectory )
throws DriverConfigurationException
{
return new File( workloadsDirectory, "ldbc/snb/bi/ldbc_snb_bi_SF-0001.properties" );
}

public static Map<String,String> defaultConfigSF1() throws DriverConfigurationException, IOException
private static Map<String,String> resourceToMap( String filename ) throws IOException
{
return ConsoleAndFileDriverConfiguration.convertLongKeysToShortKeys(
MapUtils.loadPropertiesToMap(
defaultConfigFileSF1()
)
);
try ( InputStream inputStream = LdbcSnbInteractiveWorkloadConfiguration.class.getResource( filename ).openStream() )
{
Properties properties = new Properties();
properties.load( inputStream );
return new HashMap<>( Maps.fromProperties( properties ) );
}
}

public static Map<Integer,Class<? extends Operation>> operationTypeToClassMapping()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,17 @@ public List<LdbcQuery2Result> marshalResult( String serializedResults ) throws S
long personId = ((Number) resultAsList.get( 0 )).longValue();
String personFirstName = (String) resultAsList.get( 1 );
String personLastName = (String) resultAsList.get( 2 );
long postOrCommentId = ((Number) resultAsList.get( 3 )).longValue();
String postOrCommentContent = (String) resultAsList.get( 4 );
long postOrCommentCreationDate = ((Number) resultAsList.get( 5 )).longValue();
long messageId = ((Number) resultAsList.get( 3 )).longValue();
String messageContent = (String) resultAsList.get( 4 );
long messageCreationDate = ((Number) resultAsList.get( 5 )).longValue();

results.add( new LdbcQuery2Result(
personId,
personFirstName,
personLastName,
postOrCommentId,
postOrCommentContent,
postOrCommentCreationDate
messageId,
messageContent,
messageCreationDate
) );
}

Expand All @@ -151,9 +151,9 @@ public String serializeResult( Object resultsObject ) throws SerializingMarshall
resultFields.add( result.personId() );
resultFields.add( result.personFirstName() );
resultFields.add( result.personLastName() );
resultFields.add( result.postOrCommentId() );
resultFields.add( result.postOrCommentContent() );
resultFields.add( result.postOrCommentCreationDate() );
resultFields.add( result.messageId() );
resultFields.add( result.messageContent() );
resultFields.add( result.messageCreationDate() );
resultsFields.add( resultFields );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ public class LdbcQuery2Result {
private final long personId;
private final String personFirstName;
private final String personLastName;
private final long postOrCommentId;
private final String postOrCommentContent;
private final long postOrCommentCreationDate;
private final long messageId;
private final String messageContent;
private final long messageCreationDate;

public LdbcQuery2Result(long personId, String personFirstName, String personLastName, long postOrCommentId, String postOrCommentContent, long postOrCommentCreationDate) {
public LdbcQuery2Result(long personId, String personFirstName, String personLastName, long messageId, String messageContent, long messageCreationDate) {
this.personId = personId;
this.personFirstName = personFirstName;
this.personLastName = personLastName;
this.postOrCommentId = postOrCommentId;
this.postOrCommentContent = postOrCommentContent;
this.postOrCommentCreationDate = postOrCommentCreationDate;
this.messageId = messageId;
this.messageContent = messageContent;
this.messageCreationDate = messageCreationDate;
}

public long personId() {
Expand All @@ -29,16 +29,16 @@ public String personLastName() {
return personLastName;
}

public long postOrCommentId() {
return postOrCommentId;
public long messageId() {
return messageId;
}

public String postOrCommentContent() {
return postOrCommentContent;
public String messageContent() {
return messageContent;
}

public long postOrCommentCreationDate() {
return postOrCommentCreationDate;
public long messageCreationDate() {
return messageCreationDate;
}

@Override
Expand All @@ -49,13 +49,13 @@ public boolean equals(Object o) {
LdbcQuery2Result result = (LdbcQuery2Result) o;

if (personId != result.personId) return false;
if (postOrCommentCreationDate != result.postOrCommentCreationDate) return false;
if (postOrCommentId != result.postOrCommentId) return false;
if (messageCreationDate != result.messageCreationDate) return false;
if (messageId != result.messageId) return false;
if (personFirstName != null ? !personFirstName.equals(result.personFirstName) : result.personFirstName != null)
return false;
if (personLastName != null ? !personLastName.equals(result.personLastName) : result.personLastName != null)
return false;
if (postOrCommentContent != null ? !postOrCommentContent.equals(result.postOrCommentContent) : result.postOrCommentContent != null)
if (messageContent != null ? !messageContent.equals(result.messageContent) : result.messageContent != null)
return false;

return true;
Expand All @@ -67,9 +67,9 @@ public String toString() {
"personId=" + personId +
", personFirstName='" + personFirstName + '\'' +
", personLastName='" + personLastName + '\'' +
", postOrCommentId=" + postOrCommentId +
", postOrCommentContent='" + postOrCommentContent + '\'' +
", postOrCommentCreationDate=" + postOrCommentCreationDate +
", messageId=" + messageId +
", messageContent='" + messageContent + '\'' +
", messageCreationDate=" + messageCreationDate +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ public List<LdbcQuery7Result> marshalResult( String serializedResult ) throws Se
String personFirstName = (String) row.get( 1 );
String personLastName = (String) row.get( 2 );
long likeCreationDate = ((Number) row.get( 3 )).longValue();
long commentOrPostId = ((Number) row.get( 4 )).longValue();
String commentOrPostContent = (String) row.get( 5 );
long messageId = ((Number) row.get( 4 )).longValue();
String messageContent = (String) row.get( 5 );
int minutesLatency = ((Number) row.get( 6 )).intValue();
boolean isNew = (Boolean) row.get( 7 );

Expand All @@ -119,8 +119,8 @@ public List<LdbcQuery7Result> marshalResult( String serializedResult ) throws Se
personFirstName,
personLastName,
likeCreationDate,
commentOrPostId,
commentOrPostContent,
messageId,
messageContent,
minutesLatency,
isNew
) );
Expand All @@ -142,8 +142,8 @@ public String serializeResult( Object resultsObject ) throws SerializingMarshall
resultFields.add( result.personFirstName() );
resultFields.add( result.personLastName() );
resultFields.add( result.likeCreationDate() );
resultFields.add( result.commentOrPostId() );
resultFields.add( result.commentOrPostContent() );
resultFields.add( result.messageId() );
resultFields.add( result.messageContent() );
resultFields.add( result.minutesLatency() );
resultFields.add( result.isNew() );
resultsFields.add( resultFields );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ public class LdbcQuery7Result {
private final String personFirstName;
private final String personLastName;
private final long likeCreationDate;
private final long commentOrPostId;
private final String commentOrPostContent;
private final long messageId;
private final String messageContent;
private final int minutesLatency;
private final boolean isNew;

public LdbcQuery7Result(long personId, String personFirstName, String personLastName, long likeCreationDate, long commentOrPostId, String commentOrPostContent, int minutesLatency, boolean isNew) {
public LdbcQuery7Result(long personId, String personFirstName, String personLastName, long likeCreationDate, long messageId, String messageContent, int minutesLatency, boolean isNew) {
this.personId = personId;
this.personFirstName = personFirstName;
this.personLastName = personLastName;
this.likeCreationDate = likeCreationDate;
this.commentOrPostId = commentOrPostId;
this.commentOrPostContent = commentOrPostContent;
this.messageId = messageId;
this.messageContent = messageContent;
this.minutesLatency = minutesLatency;
this.isNew = isNew;
}
Expand All @@ -37,12 +37,12 @@ public long likeCreationDate() {
return likeCreationDate;
}

public long commentOrPostId() {
return commentOrPostId;
public long messageId() {
return messageId;
}

public String commentOrPostContent() {
return commentOrPostContent;
public String messageContent() {
return messageContent;
}

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

LdbcQuery7Result that = (LdbcQuery7Result) o;

if (commentOrPostId != that.commentOrPostId) return false;
if (messageId != that.messageId) return false;
if (isNew != that.isNew) return false;
if (likeCreationDate != that.likeCreationDate) return false;
if (minutesLatency != that.minutesLatency) return false;
if (personId != that.personId) return false;
if (commentOrPostContent != null ? !commentOrPostContent.equals(that.commentOrPostContent) : that.commentOrPostContent != null)
if (messageContent != null ? !messageContent.equals(that.messageContent) : that.messageContent != null)
return false;
if (personFirstName != null ? !personFirstName.equals(that.personFirstName) : that.personFirstName != null)
return false;
Expand All @@ -82,10 +82,10 @@ public String toString() {
", personFirstName='" + personFirstName + '\'' +
", personLastName='" + personLastName + '\'' +
", likeCreationDate=" + likeCreationDate +
", commentOrPostId=" + commentOrPostId +
", commentOrPostContent='" + commentOrPostContent + '\'' +
", messageId=" + messageId +
", messageContent='" + messageContent + '\'' +
", minutesLatency=" + minutesLatency +
", isNew=" + isNew +
'}';
}
}
}
Loading

0 comments on commit f586a58

Please sign in to comment.