I'll shorten the original mail:
There is an existing test, which worked formerly, because there were 4
different impls of WindupProcessor#execute().
Now if done through a execute(WindupProcessorConfig), it tries to set
the outputDir of the graph, which fails because the graph is already
initialized, because the test needs to put some data to it.
Even shorter:
test(){
init graph;
put some data to graph;
create WindupProcessorConfig, including outputDir
call WindupProcessor#execute( config );
}
execute(){
initializeGraph( config )
}
Ondra
On 4.9.2014 15:21, Pete Muir wrote:
What are you actually trying to test?
On 4 Sep 2014, at 14:19, Ondrej Zizka <ozizka(a)redhat.com> wrote:
> I think I will need more explanation on this.
> I still don't know how could I test WindupProcessor, which should
> initialize the graph, while having the graph already initialized.
> Is that what the description below would solve?
>
> Ondra
>
>
> On 4.9.2014 11:27, Pete Muir wrote:
>> Create a class for each bootstrap phase you want. Create an ordered list of the
phase classes. Iterate over the list. Emit a CDI event for each phase, and have anything
that needs to execute in that phase observe that event and start. Observe the built in
@Initialized ApplicationContext event to kick off your bootstrap class.
>>
>> On 3 Sep 2014, at 23:38, Ondrej Zizka <ozizka(a)redhat.com> wrote:
>>
>>> Hi all,
>>>
>>> I've hit a problem with bootstrapping.
>>> The tests grab the parts of windup through CDI and that initializes them
>>> with defaults.
>>>
>>> For example, JavaClassTest#testIterationVariableResolving():
>>>
>>> The context initializes at the first line.
>>> When processor.execute() is called, the graph was somehow reused before,
>>> but that's just because of different code in all the execute() methods.
>>>
>>> I could simply not set the output dir to WindupProcessorConfig, but the
>>> output is not just where graph is.
>>> I could also check if the graph already has been initialized, but 1)
>>> that would make it nonconfigurable, 2) it would be nonsystemic -
>>> checking in init code if a part of application being initialized was, by
>>> accident, initialized somewhere else.
>>>
>>> My suggestion is that we should have kind of bootstrap API for the
>>> graph, similar to WindupProcessor - with a config class, and initialize
>>> it from that.
>>> I don't know how to combine that with CDI, so the tests would have to
>>> use that API instead of CDI.
>>> That's something I have suggested before, and was rejected, perhaps I
>>> didn't explain it clearly back then.
>>>
>>> I can't think up any other solution that I would not consider overkill,
>>> like, some CDI providers of the config.
>>> Any suggestions?
>>>
>>> Ondra
>>>
>>>
-------------------------------------------------------------------------------
>>> Test set: org.jboss.windup.rules.java.JavaClassTest
>>>
-------------------------------------------------------------------------------
>>> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 28.678
>>> sec <<< FAILURE! - in org.jboss.windup.rules.java.JavaClassTest
>>> testIterationVariableResolving(org.jboss.windup.rules.java.JavaClassTest)
Time
>>> elapsed: 5.346 sec <<< ERROR!
>>>
org.jboss.windup.util.exception.WindupException_$$_javassist_9c4de665-baa6-4904-a4d3-37530e41e5a0:
>>> Error, attempting to set graph directory to:
>>>
"/home/ondra/work/Migration/Windup/rules/app/java/target/windup_5ba22a23-c85f-49f3-b01c-39fda0eb1faa/graph",
>>> but the graph has already been initialized (with graph folder:
>>>
"/home/ondra/work/Migration/Windup/rules/app/java/target/windupgraph_1cfccd03-8f33-43a4-a305-99fdd38bc172"!
>>> To change this, you must first disconnect from the graph!
>>> at
>>>
org.jboss.windup.graph.GraphContextImpl.setGraphDirectory(GraphContextImpl.java:101)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> at
>>>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>> at
>>>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>> at java.lang.reflect.Method.invoke(Method.java:606)
>>> at
>>>
org.jboss.weld.bean.proxy.AbstractBeanInstance.invoke(AbstractBeanInstance.java:38)
>>> at
>>>
org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:100)
>>> at
>>>
org.jboss.weld.proxies.GraphContext$2110577583$Proxy$_$$_WeldClientProxy.setGraphDirectory(Unknown
>>> Source)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> at
>>>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>> at
>>>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>> at java.lang.reflect.Method.invoke(Method.java:606)
>>> at
>>>
org.jboss.forge.furnace.proxy.ClassLoaderInterceptor$1.call(ClassLoaderInterceptor.java:87)
>>> at
>>> org.jboss.forge.furnace.util.ClassLoaders.executeIn(ClassLoaders.java:40)
>>> at
>>>
org.jboss.forge.furnace.proxy.ClassLoaderInterceptor.invoke(ClassLoaderInterceptor.java:103)
>>> at
>>>
org.jboss.windup.graph.GraphContext_$$_javassist_328a8426-f2d1-4f83-9490-e69b40a9c068.setGraphDirectory(GraphContext_$$_javassist_328a8426-f2d1-4f83-9490-e69b40a9c068.java)
>>> at
>>>
org.jboss.windup.exec.WindupProcessorImpl.execute(WindupProcessorImpl.java:35)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> at
>>>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>> at
>>>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>> at java.lang.reflect.Method.invoke(Method.java:606)
>>> at
>>>
org.jboss.forge.furnace.proxy.ClassLoaderInterceptor$1.call(ClassLoaderInterceptor.java:87)
>>> at
>>> org.jboss.forge.furnace.util.ClassLoaders.executeIn(ClassLoaders.java:40)
>>> at
>>>
org.jboss.forge.furnace.proxy.ClassLoaderInterceptor.invoke(ClassLoaderInterceptor.java:103)
>>> at
>>>
org.jboss.windup.exec.WindupProcessorImpl_$$_javassist_5bf57ffb-10b3-495a-81bb-f630878e67e5.execute(WindupProcessorImpl_$$_javassist_5bf57ffb-10b3-495a-81bb-f630878e67e5.java)
>>> at
>>>
org.jboss.windup.rules.java.JavaClassTest.testIterationVariableResolving(JavaClassTest.java:118)
>>>
>>>
>>> _______________________________________________
>>> windup-dev mailing list
>>> windup-dev(a)lists.jboss.org
>>>
https://lists.jboss.org/mailman/listinfo/windup-dev
>> _______________________________________________
>> windup-dev mailing list
>> windup-dev(a)lists.jboss.org
>>
https://lists.jboss.org/mailman/listinfo/windup-dev
> _______________________________________________
> windup-dev mailing list
> windup-dev(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/windup-dev
_______________________________________________
windup-dev mailing list
windup-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/windup-dev