Skip to content

Commit

Permalink
Fixed last (hope) distributed test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
lvca committed Aug 4, 2015
1 parent 4102440 commit 0dbd91d
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 33 deletions.
Expand Up @@ -90,39 +90,43 @@ public void init(final int servers) {
public void execute() throws Exception {
System.out.println("Starting test against " + serverInstance.size() + " server nodes...");

for (ServerRun server : serverInstance) {
log("STARTING SERVER -> " + server.getServerId() + "...");
server.startServer(getDistributedServerConfiguration(server));
try {

for (ServerRun server : serverInstance) {
log("STARTING SERVER -> " + server.getServerId() + "...");
server.startServer(getDistributedServerConfiguration(server));

if (delayServerStartup > 0)
try {
Thread.sleep(delayServerStartup * serverInstance.size());
} catch (InterruptedException e) {
}

if (delayServerStartup > 0)
onServerStarted(server);
}

if (delayServerAlign > 0)
try {
Thread.sleep(delayServerStartup * serverInstance.size());
System.out.println("Server started, waiting for synchronization (" + (delayServerAlign * serverInstance.size() / 1000)
+ "secs)...");
Thread.sleep(delayServerAlign * serverInstance.size());
} catch (InterruptedException e) {
}

onServerStarted(server);
}

if (delayServerAlign > 0)
try {
System.out.println("Server started, waiting for synchronization (" + (delayServerAlign * serverInstance.size() / 1000)
+ "secs)...");
Thread.sleep(delayServerAlign * serverInstance.size());
} catch (InterruptedException e) {
for (ServerRun server : serverInstance) {
final ODocument cfg = server.getServerInstance().getDistributedManager().getClusterConfiguration();
Assert.assertNotNull(cfg);
}

for (ServerRun server : serverInstance) {
final ODocument cfg = server.getServerInstance().getDistributedManager().getClusterConfiguration();
Assert.assertNotNull(cfg);
}
log("Executing test...");

log("Executing test...");
try {
executeTest();
} finally {
onAfterExecution();
}

try {
executeTest();
} finally {
onAfterExecution();

log("Shutting down nodes...");
for (ServerRun server : serverInstance) {
System.out.println("Shutting down node " + server.getServerId() + "...");
Expand Down
@@ -1,12 +1,14 @@
package com.orientechnologies.orient.server.distributed;

import junit.framework.Assert;

import org.junit.Test;

import com.orientechnologies.common.exception.OException;
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx;
import com.orientechnologies.orient.core.record.impl.ODocument;
import com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerSchemaAware2CSV;
import com.orientechnologies.orient.core.sql.query.OSQLSynchQuery;
import junit.framework.Assert;
import org.junit.Test;

public class TestDistributeConfigSerialization extends AbstractServerClusterTest {

Expand All @@ -29,7 +31,7 @@ protected void executeTest() throws Exception {
db.close();
} catch (OException e) {
e.printStackTrace();
Assert.fail("error creating a csv database in distributed environment");
Assert.fail("error on creating a csv database in distributed environment");
}
try {
db = new ODatabaseDocumentTx("remote:localhost/" + getDatabaseName());
Expand All @@ -38,7 +40,7 @@ protected void executeTest() throws Exception {
db.close();
} catch (OException e) {
e.printStackTrace();
Assert.fail("error creating a csv database in distributed environment");
Assert.fail("error on creating a csv database in distributed environment");
}

}
Expand Down
Expand Up @@ -18,7 +18,6 @@ public class TestShardingManualSync extends AbstractServerClusterTest {
public void test() throws Exception {
init(SERVERS);
prepare(true);

execute();
}

Expand Down
Expand Up @@ -117,20 +117,19 @@ public Object execute(final OServer iServer, ODistributedServerManager iManager,

final FileOutputStream fileOutputStream = new FileOutputStream(backupFile);
try {
final List<String> compessedFiles = database.backup(fileOutputStream, null, new Callable<Object>() {
final List<String> compressedFiles = database.backup(fileOutputStream, null, new Callable<Object>() {
@Override
public Object call() throws Exception {
lastOperationId.set(database.getStorage().getLastOperationId());
return null;
}
}, this, OGlobalConfiguration.DISTRIBUTED_DEPLOYDB_TASK_COMPRESSION.getValueAsInteger(), CHUNK_MAX_SIZE);

if (compessedFiles.size() < 2) {
throw new ODistributedException("Cannot backup database, compressed files: " + compessedFiles);
if (compressedFiles.size() < 2) {
throw new ODistributedException("Cannot backup database, compressed files: " + compressedFiles);
}

ODistributedServerLog.info(this, iManager.getLocalNodeName(), null, DIRECTION.NONE, "compressed %d files",
compessedFiles.size());
ODistributedServerLog.info(this, iManager.getLocalNodeName(), null, DIRECTION.NONE, "compressed %d files", compressedFiles.size());

} finally {
fileOutputStream.close();
Expand Down

0 comments on commit 0dbd91d

Please sign in to comment.