Package org.openquark.cal.runtime

Examples of org.openquark.cal.runtime.ExecutionContext


        CompilerMessageLogger messageLogger = new MessageLogger();
        if (!calServices.compileWorkspace(null, messageLogger)) {
            System.err.println(messageLogger.toString());
        }

        final ExecutionContext executionContext = calServices.getWorkspaceManager().makeExecutionContextWithDefaultProperties();

        WorkspaceManager workspaceManager = calServices.getWorkspaceManager();
        Compiler compiler = calServices.getCompiler();
        optimizer_entryPoint = compiler.getEntryPoint(
                EntryPointSpec.make(CAL_Optimizer_internal.Functions.optimize),
View Full Code Here


                CALPlatformTestModuleNames.RuntimeRegression, messageLogger);
            if (messageLogger.getNMessages() > 0) {
                System.err.println(messageLogger.toString());
            }

            final ExecutionContext executionContext = leccCALServices.getWorkspaceManager().makeExecutionContextWithDefaultProperties();

            CALExecutor executor = workspaceManager.makeExecutor(executionContext);
            try {
                Object result = executor.exec(entryPoint, new Object[] { new Integer(1), new Integer(2)});
                assertTrue(((Integer)result).intValue() == 6);
View Full Code Here

                CALPlatformTestModuleNames.RuntimeRegression, messageLogger);
            if (messageLogger.getNMessages() > 0) {
                System.err.println(messageLogger.toString());
            }

            final ExecutionContext executionContext = gCALServices.getWorkspaceManager().makeExecutionContextWithDefaultProperties();

            CALExecutor executor = workspaceManager.makeExecutor(executionContext);
            try {
                Object result = executor.exec(entryPoint, new Object[] { new Integer(1), new Integer(2)});
                assertTrue(((Integer)result).intValue() == 6);
View Full Code Here

    private void help_testGetProperty(BasicCALServices calServices, String propKey, Object propValue) throws CALExecutorException, GemCompilationException {
       
        ExecutionContextProperties.Builder propBuilder = new ExecutionContextProperties.Builder();
        propBuilder.setProperty(propKey, propValue);
        ExecutionContextProperties properties = propBuilder.toProperties();
        ExecutionContext ec = calServices.getWorkspaceManager().makeExecutionContext(properties);
       
        assertSame(propValue, calServices.runFunction(EntryPointSpec.make(CAL_System.Functions.getProperty), ec, new Object[] { propKey }));
       
        assertEquals(Boolean.TRUE, calServices.runFunction(EntryPointSpec.make(CAL_System.Functions.hasProperty), ec, new Object[] { propKey }));
View Full Code Here

   
    private void help_testCurrentLocale(BasicCALServices calServices, Locale locale) throws CALExecutorException, GemCompilationException {
        ExecutionContextProperties.Builder propBuilder = new ExecutionContextProperties.Builder();
        propBuilder.setLocale(locale);
        ExecutionContextProperties properties = propBuilder.toProperties();
        ExecutionContext ec = calServices.getWorkspaceManager().makeExecutionContext(properties);
       
        assertSame(locale, calServices.runFunction(EntryPointSpec.make(CAL_System.Functions.getProperty), ec, new Object[] { ExecutionContextProperties.SYS_PROP_KEY_LOCALE }));
    }
View Full Code Here

   
    private void help_testCurrentTimeZone(BasicCALServices calServices, TimeZone timeZone) throws CALExecutorException, GemCompilationException {       
        ExecutionContextProperties.Builder propBuilder = new ExecutionContextProperties.Builder();
        propBuilder.setTimeZone(timeZone.getID());
        ExecutionContextProperties properties = propBuilder.toProperties();
        ExecutionContext ec = calServices.getWorkspaceManager().makeExecutionContext(properties);
       
        final java.util.TimeZone propertyValue = (java.util.TimeZone)calServices.runFunction(EntryPointSpec.make(CAL_System.Functions.getProperty), ec, new Object[] {ExecutionContextProperties.SYS_PROP_KEY_TIMEZONE});
        assertEquals(timeZone, TimeZone.getInstance(propertyValue.getID()));
    }
View Full Code Here

        TestCleanable hook = new TestCleanable();
       
        ExecutionContextProperties.Builder propBuilder = new ExecutionContextProperties.Builder();
        propBuilder.setProperty("hook", hook);
        ExecutionContextProperties properties = propBuilder.toProperties();
        ExecutionContext executionContext = calServices.getWorkspaceManager().makeExecutionContext(properties);
       
        EntryPoint entryPoint = calServices.getCompiler().getEntryPoint(
            new AdjunctSource.FromText("private tempFunc = System.registerCleanable ((input (System.getProperty \"hook\")) :: Cleanable);"),
            EntryPointSpec.make(QualifiedName.make(CAL_System.MODULE_NAME, "tempFunc")),
            CAL_System.MODULE_NAME,
View Full Code Here

    private static final TypeExprDefn STRING_TYPE = TypeExprDefn.TypeCons.make(CAL_Prelude.TypeConstructors.String);
    private static final TypeExprDefn STRING_LIST_TYPE = TypeExprDefn.List.make(STRING_TYPE);
   
    public void testTouchesThenRuns() throws CALExecutorException, GemCompilationException {
        // Touch the List.head() function
        final ExecutionContext executionContext = calServices.getWorkspaceManager().makeExecutionContextWithDefaultProperties();

        EntryPointSpec headString = EntryPointSpec.make(CAL_List.Functions.head,
                OutputPolicy.makeTypedDefaultOutputPolicy(STRING_TYPE));
        entryPointCache.cacheEntryPoints(Collections.singletonList(headString));
       
View Full Code Here

        final EntryPointSpec headString = EntryPointSpec.make(CAL_List.Functions.head,
                OutputPolicy.makeTypedDefaultOutputPolicy(STRING_TYPE));

        // Create many threads that will use the same entry point - the first should
        // safely compile the adjunct and the rest should use it without compiling again
        final ExecutionContext executionContext = calServices.getWorkspaceManager().makeExecutionContextWithDefaultProperties();
        Runnable functionCallRunnable = new Runnable() {
            public void run() {
                try {
                    assertEquals("one", entryPointCache.runFunction(headString, new Object[] { TEST_LIST }, executionContext));
                } catch (CALExecutorException e) {
View Full Code Here

                OutputPolicy.makeTypedDefaultOutputPolicy(STRING_LIST_TYPE));
        final EntryPointSpec lengthString = EntryPointSpec.make(CAL_List.Functions.length,
                new InputPolicy[] { InputPolicy.makeTypedDefaultInputPolicy(STRING_LIST_TYPE)},
                OutputPolicy.DEFAULT_OUTPUT_POLICY);
       
        final ExecutionContext executionContext = calServices.getWorkspaceManager().makeExecutionContextWithDefaultProperties();

        // Use a status listener to assert that the List adjunct module is only compiled twice
        calServices.getWorkspaceManager().addStatusListener(listCompilationListener);
        allowedListCompilations++;
       
View Full Code Here

TOP

Related Classes of org.openquark.cal.runtime.ExecutionContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.