Hi all

Now i'm using ivy 6.3.0 and also use rule engine was already embedded inside, everything was fine when i use in ivy environment. but when i want to write unit test for the rule (.drl), i got exception in this line:

IRuleBase ruleBase = Rules.engine().createRuleBase()

Here is exception:

com.google.common.util.concurrent.ExecutionError: com.google.common.util.concurrent.ExecutionError: com.google.common.util.concurrent.ExecutionError: com.google.common.util.concurrent.ExecutionError: com.google.common.util.concurrent.ExecutionError: com.google.common.util.concurrent.ExecutionError: com.google.common.util.concurrent.ExecutionError: com.google.common.util.concurrent.ExecutionError: java.lang.NoClassDefFoundError: ch/ivyteam/ivy/job/IJobManager
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2199)
    at com.google.common.cache.LocalCache.get(LocalCache.java:3934)
    at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3938)
    at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4821)
    at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4827)
    at com.google.inject.internal.FailableCache.get(FailableCache.java:48)
    at com.google.inject.internal.ConstructorInjectorStore.get(ConstructorInjectorStore.java:50)
    at com.google.inject.internal.ConstructorBindingImpl.initialize(ConstructorBindingImpl.java:136)
    at com.google.inject.internal.InjectorImpl.initializeJitBinding(InjectorImpl.java:547)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:884)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:805)
    at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:282)
    at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:214)
    at com.google.inject.internal.ProvidedByInternalFactory.initialize(ProvidedByInternalFactory.java:57)
    at com.google.inject.internal.LinkedProviderBindingImpl.initialize(LinkedProviderBindingImpl.java:76)
    at com.google.inject.internal.InjectorImpl.initializeJitBinding(InjectorImpl.java:547)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:884)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:805)
    at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:282)
    at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:214)
    at com.google.inject.internal.InjectorImpl.getProviderOrThrow(InjectorImpl.java:1006)
    at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:1038)
    at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:1001)
    at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1051)
    at ch.ivyteam.di.restricted.DiInjector.getInstance(DiInjector.java:43)
    at ch.ivyteam.ivy.rule.engine.internal.RuleEngine.createRuleBase(RuleEngine.java:14)
    at ch.axonivy.fintech.standard.guiframework.util.RuleStore.getStatelessRuleSession(RuleStore.java:64)
    at ch.axonivy.fintech.standard.rulesengine.DroolsService.applyBusinessRules(DroolsService.java:51)
    at ch.axonivy.fintech.standard.rulesengine.DroolsRuleEngine.executeBusinessRule(DroolsRuleEngine.java:71)
    at ch.axonivy.fintech.standard.rulesengine.BusinessRuleProvider.executeBusinessRule(BusinessRuleProvider.java:49)
    at ch.axonivy.fintech.standard.guiframework.core.RuleProcessor.executeBusinessRule(RuleProcessor.java:76)
    at ch.axonivy.fintech.standard.guiframework.workflow.BaseGuiWorkflow.initGlobalVar(BaseGuiWorkflow.java:316)
    at ch.axonivy.fintech.standard.qualification.processor.QualificationBusinessDecisionProcessor.initGlobalVarIfNeeded(QualificationBusinessDecisionProcessor.java:28)
    at ch.axonivy.fintech.mortgage.qualification.service.QualificationBusinessService.proceedQualificationDecision(QualificationBusinessService.java:22)
    at ch.axonivy.fintech.soba.test.integration.SobaQualificationBusinessServiceTest.should_return_dossier_status_GREEN_when_all_check_result_GREEN(SobaQualificationBusinessServiceTest.java:47)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: com.google.common.util.concurrent.ExecutionError: com.google.common.util.concurrent.ExecutionError: com.google.common.util.concurrent.ExecutionError: com.google.common.util.concurrent.ExecutionError: com.google.common.util.concurrent.ExecutionError: com.google.common.util.concurrent.ExecutionError: com.google.common.util.concurrent.ExecutionError: java.lang.NoClassDefFoundError: ch/ivyteam/ivy/job/IJobManager
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2199)
    at com.google.common.cache.LocalCache.get(LocalCache.java:3934)
    at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3938)
    at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4821)
    at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4827)
    at com.google.inject.internal.FailableCache.get(FailableCache.java:48)
    at com.google.inject.internal.MembersInjectorStore.get(MembersInjectorStore.java:68)
    at com.google.inject.internal.ConstructorInjectorStore.createConstructor(ConstructorInjectorStore.java:74)
    at com.google.inject.internal.ConstructorInjectorStore.access$000(ConstructorInjectorStore.java:29)
    at com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:37)
    at com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:33)
    at com.google.inject.internal.FailableCache$1.load(FailableCache.java:37)
    at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3524)
    at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2317)
    at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2280)
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2195)
    ... 57 more
Caused by: com.google.common.util.concurrent.ExecutionError: com.google.common.util.concurrent.ExecutionError: com.google.common.util.concurrent.ExecutionError: com.google.common.util.concurrent.ExecutionError: com.google.common.util.concurrent.ExecutionError: com.google.common.util.concurrent.ExecutionError: java.lang.NoClassDefFoundError: ch/ivyteam/ivy/job/IJobManager
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2199)
    at com.google.common.cache.LocalCache.get(LocalCache.java:3934)
    at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3938)
    at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4821)
    at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4827)
    at com.google.inject.internal.FailableCache.get(FailableCache.java:48)
    at com.google.inject.internal.ConstructorInjectorStore.get(ConstructorInjectorStore.java:50)
    at com.google.inject.internal.ConstructorBindingImpl.initialize(ConstructorBindingImpl.java:136)
    at com.google.inject.internal.InjectorImpl.initializeJitBinding(InjectorImpl.java:547)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:884)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:805)
    at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:282)
    at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:214)
    at com.google.inject.internal.InjectorImpl.createImplementedByBinding(InjectorImpl.java:749)
    at com.google.inject.internal.InjectorImpl.createUninitializedBinding(InjectorImpl.java:647)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:882)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:805)
    at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:282)
    at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:214)
    at com.google.inject.internal.SingleFieldInjector.<init>(SingleFieldInjector.java:42)
    at com.google.inject.internal.MembersInjectorStore.getInjectors(MembersInjectorStore.java:131)
    at com.google.inject.internal.MembersInjectorStore.createWithListeners(MembersInjectorStore.java:98)
    at com.google.inject.internal.MembersInjectorStore.access$000(MembersInjectorStore.java:37)
    at com.google.inject.internal.MembersInjectorStore$1.create(MembersInjectorStore.java:45)
    at com.google.inject.internal.MembersInjectorStore$1.create(MembersInjectorStore.java:42)
    at com.google.inject.internal.FailableCache$1.load(FailableCache.java:37)
    at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3524)
    at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2317)
    at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2280)
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2195)
    ... 72 more
Caused by: java.lang.ClassNotFoundException: ch.ivyteam.ivy.job.IJobManager
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 238 more

Does anyone know why and is there any ways to write ut test for rules?

asked 09.02.2017 at 10:28

trungdv's gravatar image

trungdv
(suspended)
accept rate: 52%


Hi all in order to call this api in junit, your test case must extended from:

ch.ivyteam.ivy.rule.engine.testing.AbstractRuleEngineTest

it works for me

link

answered 09.02.2017 at 11:17

trungdv's gravatar image

trungdv
(suspended)
accept rate: 52%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×4

Asked: 09.02.2017 at 10:28

Seen: 2,646 times

Last updated: 09.02.2017 at 11:17