java.lang.ClassLoader cl = getClassLoader(); ContextImpl appContext = new ContextImpl(); appContext.init(this, null, mActivityThread); app = mActivityThread.mInstrumentation.newApplication(cl, appClass, appContext); ... mApplication = app;
final ContextImpl appContext = new ContextImpl(); appContext.init(data.info, null, this); final File cacheDir = appContext.getCacheDir(); // Provide a usable directory for temporary files System.setProperty("java.io.tmpdir", cacheDir.getAbsolutePath()); // line 3979 setupGraphicsSupport(data.info, cacheDir);
@Before public void init() { registryContext = new ContextImpl(); dmnRuntime = kieContainer.newKieSession().getKieRuntime(DMNRuntime.class); }
final ContextImpl appContext = new ContextImpl(); appContext.init(data.info, null, this); if (!Process.isIsolated()) { final File cacheDir = appContext.getCacheDir(); if (cacheDir != null) { // Provide a usable directory for temporary files System.setProperty("java.io.tmpdir", cacheDir.getAbsolutePath()); setupGraphicsSupport(data.info, cacheDir); } else { Log.e(TAG, "Unable to setupGraphicsSupport due to missing cache directory"); } }
@Before public void init() { registryContext = new ContextImpl(); dmnRuntime = kieContainer.newKieSession().getKieRuntime(DMNRuntime.class); }
@Test public void execute() { RegistryContext registryContext = new ContextImpl(); GetDMNDecisionResultsCommand getDMNDecisionResultsCommand = new GetDMNDecisionResultsCommand(); assertThatThrownBy(() -> getDMNDecisionResultsCommand.execute(registryContext)) .isInstanceOf(IllegalStateException.class) .hasMessage("There is no DMNResult available"); DMNResultImpl dmnResult = new DMNResultImpl(null); dmnResult.setContext(new DMNContextImpl()); registryContext.register(DMNResult.class, dmnResult); List<DMNDecisionResult> result = getDMNDecisionResultsCommand.execute(registryContext); assertEquals(0, result.size()); } }
@Test public void execute() { RegistryContext registryContext = new ContextImpl(); NewDMNRuntimeCommand newDMNRuntimeCommand = new NewDMNRuntimeCommand(); assertThatThrownBy(() -> newDMNRuntimeCommand.execute(registryContext)) .isInstanceOf(IllegalStateException.class) .hasMessage("There is no existing KieContainer assigned to the Registry"); registryContext.register(KieContainer.class, new KieHelper().getKieContainer()); newDMNRuntimeCommand.execute(registryContext); assertNotNull(registryContext.lookup(DMNRuntime.class)); } }
@Test public void execute() { RegistryContext registryContext = new ContextImpl(); GetAllDMNContextCommand getAllDMNContextCommand = new GetAllDMNContextCommand(); assertThatThrownBy(() -> getAllDMNContextCommand.execute(registryContext)) .isInstanceOf(IllegalStateException.class) .hasMessage("There is not DMNResult available"); DMNResultImpl dmnResult = new DMNResultImpl(null); dmnResult.setContext(new DMNContextImpl()); registryContext.register(DMNResult.class, dmnResult); Map<String, Object> result = getAllDMNContextCommand.execute(registryContext); assertEquals(0, result.size()); } }
@Test public void execute() { RegistryContext registryContext = new ContextImpl(); GetDMNMessagesCommand getDMNMessagesCommand = new GetDMNMessagesCommand(); assertThatThrownBy(() -> getDMNMessagesCommand.execute(registryContext)) .isInstanceOf(IllegalStateException.class) .hasMessage("There is no DMNResult available"); DMNResultImpl dmnResult = new DMNResultImpl(null); dmnResult.setContext(new DMNContextImpl()); registryContext.register(DMNResult.class, dmnResult); List<DMNMessage> result = getDMNMessagesCommand.execute(registryContext); assertEquals(0, result.size()); } }
@Test public void execute() { RegistryContext registryContext = new ContextImpl(); ExecuteDMNCommand executeDMNCommand = new ExecuteDMNCommand(); assertThatThrownBy(() -> executeDMNCommand.execute(registryContext)) .isInstanceOf(IllegalStateException.class) .hasMessage("No DMN active model defined"); registryContext.register(DMNModel.class, new DMNModelImpl(null)); assertThatThrownBy(() -> executeDMNCommand.execute(registryContext)) .isInstanceOf(IllegalStateException.class) .hasMessage("No DMNRuntime available"); DMNContext dmnContext = DMNFactory.newContext(); dmnContext.set("example", 10); registryContext.register(DMNRuntime.class, new DMNRuntimeImpl(null)); registryContext.register(DMNContext.class, dmnContext); DMNResult result = executeDMNCommand.execute(registryContext); assertNotNull(result); DMNContext newDmnContext = registryContext.lookup(DMNContext.class); assertEquals(1, dmnContext.getAll().size()); assertEquals(0, newDmnContext.getAll().size()); } }
@Test public void execute() { RegistryContext registryContext = new ContextImpl(); String testVariable = "testVariable"; SetDMNInputCommand setDMNInputCommand = new SetDMNInputCommand(testVariable, 10); setDMNInputCommand.execute(registryContext); DMNContext lookup = registryContext.lookup(DMNContext.class); assertTrue(lookup.isDefined(testVariable)); } }