Search in sources :

Example 6 with Services

use of org.structr.core.Services in project structr by structr.

the class StructrCsvModuleTest method startSystem.

@BeforeClass
public static void startSystem() {
    final Date now = new Date();
    final long timestamp = now.getTime();
    basePath = "/tmp/structr-test-" + timestamp;
    Settings.Services.setValue("NodeService LogService SchemaService");
    Settings.ConnectionUrl.setValue(Settings.TestingConnectionUrl.getValue());
    // example for new configuration setup
    Settings.BasePath.setValue(basePath);
    Settings.DatabasePath.setValue(basePath + "/db");
    Settings.FilesPath.setValue(basePath + "/files");
    Settings.RelationshipCacheSize.setValue(1000);
    Settings.NodeCacheSize.setValue(1000);
    Settings.SuperUserName.setValue("superadmin");
    Settings.SuperUserPassword.setValue("sehrgeheim");
    final Services services = Services.getInstance();
    // wait for service layer to be initialized
    do {
        try {
            Thread.sleep(100);
        } catch (Throwable t) {
        }
    } while (!services.isInitialized());
    securityContext = SecurityContext.getSuperUserInstance();
    app = StructrApp.getInstance(securityContext);
}
Also used : Services(org.structr.core.Services) Date(java.util.Date) BeforeClass(org.junit.BeforeClass)

Example 7 with Services

use of org.structr.core.Services in project structr by structr.

the class StructrTest method startSystem.

@BeforeClass
public static void startSystem() {
    final Date now = new Date();
    final long timestamp = now.getTime();
    basePath = "/tmp/structr-test-" + timestamp;
    Settings.Services.setValue("NodeService LogService SchemaService");
    Settings.ConnectionUrl.setValue(Settings.TestingConnectionUrl.getValue());
    // example for new configuration setup
    Settings.BasePath.setValue(basePath);
    Settings.DatabasePath.setValue(basePath + "/db");
    Settings.FilesPath.setValue(basePath + "/files");
    Settings.RelationshipCacheSize.setValue(1000);
    Settings.NodeCacheSize.setValue(1000);
    Settings.SuperUserName.setValue("superadmin");
    Settings.SuperUserPassword.setValue("sehrgeheim");
    // Settings.CypherDebugLogging.setValue(true);
    final Services services = Services.getInstance();
    // wait for service layer to be initialized
    do {
        try {
            Thread.sleep(100);
        } catch (Throwable t) {
        }
    } while (!services.isInitialized());
    securityContext = SecurityContext.getSuperUserInstance();
    app = StructrApp.getInstance(securityContext);
}
Also used : Services(org.structr.core.Services) Date(java.util.Date) BeforeClass(org.junit.BeforeClass)

Example 8 with Services

use of org.structr.core.Services in project structr by structr.

the class PropertyViewRestTest method start.

public static void start(final Map<String, Object> additionalConfig) {
    final Date now = new Date();
    final long timestamp = now.getTime();
    basePath = "/tmp/structr-test-" + timestamp;
    // modify default date format
    Settings.DefaultDateFormat.setValue("yyyy-MM-dd'T'HH:mm:ss.SSSXXX");
    Settings.Services.setValue("NodeService LogService HttpService SchemaService");
    Settings.ConnectionUrl.setValue(Settings.TestingConnectionUrl.getValue());
    // example for new configuration setup
    Settings.BasePath.setValue(basePath);
    Settings.DatabasePath.setValue(basePath + "/db");
    Settings.FilesPath.setValue(basePath + "/files");
    Settings.RelationshipCacheSize.setValue(1000);
    Settings.NodeCacheSize.setValue(1000);
    Settings.SuperUserName.setValue("superadmin");
    Settings.SuperUserPassword.setValue("sehrgeheim");
    Settings.ApplicationTitle.setValue("structr unit test app" + timestamp);
    Settings.ApplicationHost.setValue(host);
    Settings.HttpPort.setValue(httpPort);
    Settings.Servlets.setValue("JsonRestServlet");
    Settings.RestAuthenticator.setValue(SuperUserAuthenticator.class.getName());
    Settings.RestResourceProvider.setValue(DefaultResourceProvider.class.getName());
    Settings.RestServletPath.setValue(restUrl);
    Settings.RestUserClass.setValue("");
    final Services services = Services.getInstance();
    securityContext = SecurityContext.getSuperUserInstance();
    app = StructrApp.getInstance(securityContext);
    // wait for service layer to be initialized
    do {
        try {
            Thread.sleep(100);
        } catch (Throwable t) {
        }
    } while (!services.isInitialized());
}
Also used : Services(org.structr.core.Services) SuperUserAuthenticator(org.structr.core.auth.SuperUserAuthenticator) Date(java.util.Date) DefaultResourceProvider(org.structr.rest.DefaultResourceProvider)

Example 9 with Services

use of org.structr.core.Services in project structr by structr.

the class StructrRestTest method start.

@BeforeClass
public static void start() {
    final Date now = new Date();
    final long timestamp = now.getTime();
    basePath = "/tmp/structr-test-" + timestamp;
    Settings.Services.setValue("NodeService LogService HttpService SchemaService");
    Settings.ConnectionUrl.setValue(Settings.TestingConnectionUrl.getValue());
    // example for new configuration setup
    Settings.BasePath.setValue(basePath);
    Settings.DatabasePath.setValue(basePath + "/db");
    Settings.FilesPath.setValue(basePath + "/files");
    Settings.RelationshipCacheSize.setValue(1000);
    Settings.NodeCacheSize.setValue(1000);
    Settings.SuperUserName.setValue("superadmin");
    Settings.SuperUserPassword.setValue("sehrgeheim");
    Settings.ApplicationTitle.setValue("structr unit test app" + timestamp);
    Settings.ApplicationHost.setValue(host);
    Settings.HttpPort.setValue(httpPort);
    Settings.Servlets.setValue("JsonRestServlet");
    Settings.RestAuthenticator.setValue(SuperUserAuthenticator.class.getName());
    Settings.RestResourceProvider.setValue(DefaultResourceProvider.class.getName());
    Settings.RestServletPath.setValue(restUrl);
    Settings.RestUserClass.setValue("");
    // Settings.LogSchemaOutput.setValue(true);
    final Services services = Services.getInstance();
    // wait for service layer to be initialized
    do {
        try {
            Thread.sleep(100);
        } catch (Throwable t) {
        }
    } while (!services.isInitialized());
    securityContext = SecurityContext.getSuperUserInstance();
    app = StructrApp.getInstance(securityContext);
    // sleep again to wait for schema initialization
    try {
        Thread.sleep(2000);
    } catch (Throwable t) {
    }
}
Also used : Services(org.structr.core.Services) SuperUserAuthenticator(org.structr.core.auth.SuperUserAuthenticator) Date(java.util.Date) DefaultResourceProvider(org.structr.rest.DefaultResourceProvider) BeforeClass(org.junit.BeforeClass)

Example 10 with Services

use of org.structr.core.Services in project structr by structr.

the class StructrPaymentModuleTest method startSystem.

@BeforeClass
public static void startSystem() {
    final Date now = new Date();
    final long timestamp = now.getTime();
    basePath = "/tmp/structr-test-" + timestamp;
    Settings.Services.setValue("NodeService LogService SchemaService HttpService AgentService");
    Settings.ConnectionUrl.setValue(Settings.TestingConnectionUrl.getValue());
    // example for new configuration setup
    Settings.BasePath.setValue(basePath);
    Settings.DatabasePath.setValue(basePath + "/db");
    Settings.FilesPath.setValue(basePath + "/files");
    Settings.RelationshipCacheSize.setValue(1000);
    Settings.NodeCacheSize.setValue(1000);
    Settings.SuperUserName.setValue("superadmin");
    Settings.SuperUserPassword.setValue("sehrgeheim");
    Settings.ApplicationTitle.setValue("structr unit test app" + timestamp);
    Settings.ApplicationHost.setValue(host);
    Settings.HttpPort.setValue(httpPort);
    Settings.Servlets.setValue("JsonRestServlet");
    // Settings.LogSchemaOutput.setValue(true);
    final Services services = Services.getInstance();
    // wait for service layer to be initialized
    do {
        try {
            Thread.sleep(100);
        } catch (Throwable t) {
        }
    } while (!services.isInitialized());
    securityContext = SecurityContext.getSuperUserInstance();
    app = StructrApp.getInstance(securityContext);
}
Also used : Services(org.structr.core.Services) Date(java.util.Date) BeforeClass(org.junit.BeforeClass)

Aggregations

Services (org.structr.core.Services)30 BeforeClass (org.junit.BeforeClass)21 Date (java.util.Date)20 SuperUserAuthenticator (org.structr.core.auth.SuperUserAuthenticator)5 DefaultResourceProvider (org.structr.rest.DefaultResourceProvider)5 GraphDatabaseCommand (org.structr.core.graph.GraphDatabaseCommand)4 Tx (org.structr.core.graph.Tx)2 IOException (java.io.IOException)1 Method (java.lang.reflect.Method)1 HttpSession (javax.servlet.http.HttpSession)1 Task (org.structr.agent.Task)1 SettingsGroup (org.structr.api.config.SettingsGroup)1 Service (org.structr.api.service.Service)1 StructrServices (org.structr.api.service.StructrServices)1 Attr (org.structr.api.util.html.Attr)1 Document (org.structr.api.util.html.Document)1 Tag (org.structr.api.util.html.Tag)1 SecurityContext (org.structr.common.SecurityContext)1 DatabaseServiceNotAvailableException (org.structr.common.error.DatabaseServiceNotAvailableException)1 FrameworkException (org.structr.common.error.FrameworkException)1