-
1. Re: [forge-dev] Issue with @FacetConstraint
gastaldi Feb 27, 2014 5:55 PM (in response to ivan_stefanov)Hi Ivan,
This is because Furnace proxies the objects to avoid ClassCastExceptions. This shouldn't present a problem though. Are your addon dependencies correctly configured? I haven't seen your project yet, but if you could reproduce this error in a test that would be great.
Em 27/02/2014, às 18:24, "Ivan St. Ivanov" <ivan.st.ivanov@gmail.com> escreveu:
Hi folks,
I am testing my Forge 2.0 addon for SAP HANA Cloud. One of my commands (the setup command) installs the special facet that I have developer (SapHanaCloudFacet). Another command is annotated with @FacetConstraint(SapHanaCloudFacet.class). Even after I do setup, the other command is not enabled.
I started the debugger. The isInstalled method of my facet returned true. So I went on to see what happens with the isEnabled() method. I dug as deep as the AbstractFaceted::safeGetFacet(Class<F> type) method. What it does is: it searches all the installed facets and it checks whether the expected one is among them by calling type.isInstance(facet).
The problem in my case is that all the facet objects are actually proxies. So I expect the type to be com.sap.cloud.forge.SapHanaCloudFacet, but it is actually something like org.jboss.forge.addon.facets.AbstractFacet_$$_javassist_904cc85e-43dd-404a-846c-ed4709d14dea. Eventually, the isInstance method returns false.
Am I doing something wrong? The code of the addon can be found here: https://github.com/ivannov/addon-saphcp.
Thanks,
Ivan
P.S. Did you, guys, bring anything new to the Windows shell? I am still using my Linux VM for Forge development.
_______________________________________________
forge-dev mailing list
-
att1.html.zip 1.3 KB
-
-
2. Re: [forge-dev] Issue with @FacetConstraint
ivan_stefanov Feb 28, 2014 9:06 AM (in response to gastaldi)Hi George,
OK, I will try to reproduce it. Could you tell me what kind of test should
I write? Something that calls isEnabled or constraintsMet in a situation
that it is assumed that they are true?
Cheers,
Ivan
On Feb 28, 2014 12:56 AM, "George Gastaldi" <ggastald@redhat.com> wrote:
Hi Ivan,
This is because Furnace proxies the objects to avoid ClassCastExceptions.
This shouldn't present a problem though. Are your addon dependencies
correctly configured? I haven't seen your project yet, but if you could
reproduce this error in a test that would be great.
Em 27/02/2014, às 18:24, "Ivan St. Ivanov" <ivan.st.ivanov@gmail.com>
escreveu:
Hi folks,
I am testing my Forge 2.0 addon for SAP HANA Cloud. One of my commands
(the setup command) installs the special facet that I have developer
(SapHanaCloudFacet). Another command is annotated
with @FacetConstraint(SapHanaCloudFacet.class). Even after I do setup, the
other command is not enabled.
I started the debugger. The isInstalled method of my facet returned true.
So I went on to see what happens with the isEnabled() method. I dug as deep
as the AbstractFaceted::safeGetFacet(Class<F> type) method. What it does
is: it searches all the installed facets and it checks whether the expected
one is among them by calling type.isInstance(facet).
The problem in my case is that all the facet objects are actually proxies.
So I expect the type to be com.sap.cloud.forge.SapHanaCloudFacet, but it is
actually something
like org.jboss.forge.addon.facets.AbstractFacet_$$_javassist_904cc85e-43dd-404a-846c-ed4709d14dea.
Eventually, the isInstance method returns false.
Am I doing something wrong? The code of the addon can be found here:
https://github.com/ivannov/addon-saphcp.
Thanks,
Ivan
P.S. Did you, guys, bring anything new to the Windows shell? I am still
using my Linux VM for Forge development.
_______________________________________________
forge-dev mailing list
https://lists.jboss.org/mailman/listinfo/forge-dev
>
_______________________________________________
forge-dev mailing list
https://lists.jboss.org/mailman/listinfo/forge-dev
-
att1.html.zip 1.5 KB
-
-
3. Re: [forge-dev] Issue with @FacetConstraint
lincolnthree Feb 28, 2014 9:22 AM (in response to ivan_stefanov)Is com.sap.cloud.forge.SapHanaCloudFacet an interface or a Class? If it is
a Class or abstract Class, does it have a default constructor?
On Fri, Feb 28, 2014 at 9:06 AM, Ivan St. Ivanov
<ivan.st.ivanov@gmail.com>wrote:
Hi George,
OK, I will try to reproduce it. Could you tell me what kind of test should
I write? Something that calls isEnabled or constraintsMet in a situation
that it is assumed that they are true?
Cheers,
Ivan
On Feb 28, 2014 12:56 AM, "George Gastaldi" <ggastald@redhat.com> wrote:
>> Hi Ivan,
>>
>> This is because Furnace proxies the objects to avoid ClassCastExceptions.
>> This shouldn't present a problem though. Are your addon dependencies
>> correctly configured? I haven't seen your project yet, but if you could
>> reproduce this error in a test that would be great.
>>
>> Em 27/02/2014, às 18:24, "Ivan St. Ivanov"
_______________________________________________
forge-dev mailing list
https://lists.jboss.org/mailman/listinfo/forge-dev
--
Lincoln Baxter, III
"Simpler is better."
-
att1.html.zip 1.8 KB
-
-
4. Re: [forge-dev] Issue with @FacetConstraint
ivan_stefanov Feb 28, 2014 10:12 AM (in response to lincolnthree)Hi Lincoln,
It's a class that extends AbstractFacet wrote:
Is com.sap.cloud.forge.SapHanaCloudFacet an interface or a Class? If it
is a Class or abstract Class, does it have a default constructor?
>
On Fri, Feb 28, 2014 at 9:06 AM, Ivan St. Ivanov <ivan.st.ivanov@gmail.com
wrote:
>> Hi George,
>>
>> OK, I will try to reproduce it. Could you tell me what kind of test
>> should I write? Something that calls isEnabled or constraintsMet in a
>> situation that it is assumed that they are true?
>>
>> Cheers,
>> Ivan
>> On Feb 28, 2014 12:56 AM, "George Gastaldi"
>
--
Lincoln Baxter, III
"Simpler is better."
_______________________________________________
forge-dev mailing list
https://lists.jboss.org/mailman/listinfo/forge-dev
-
att1.html.zip 2.1 KB
-
-
5. Re: [forge-dev] Issue with @FacetConstraint
gastaldi Feb 28, 2014 10:19 AM (in response to ivan_stefanov)That may be the issue. Provide it with a default constructor and @Inject the dependencies instead of using the constructor. A good option is to split into interface+impl. That would allow the proxy to function properly.
Em 28/02/2014, às 12:12, "Ivan St. Ivanov" <ivan.st.ivanov@gmail.com> escreveu:
Hi Lincoln,
It's a class that extends AbstractFacet<Project> and implements ProjectFacet. It has just one constructor:
@Inject
public SapHanaCloudFacet(DependencyInstaller dependencyInstaller) {
this.dependencyInstaller = dependencyInstaller;
}
Cheers,
Ivan
>> On Fri, Feb 28, 2014 at 4:22 PM, Lincoln Baxter, III https://lists.jboss.org/mailman/listinfo/forge-dev
_______________________________________________
forge-dev mailing list
-
att1.html.zip 2.4 KB
-
-
6. Re: [forge-dev] Issue with @FacetConstraint
gastaldi Feb 28, 2014 10:54 AM (in response to ivan_stefanov)Ivan,
Your install() method is returning false; Make sure to return isInstalled() instead.
-
7. Re: [forge-dev] Issue with @FacetConstraint
ivan_stefanov Mar 1, 2014 3:13 PM (in response to gastaldi)Hi folks,
I removed the constructor and made the install method of the facet to
return true. Now it works.
Thanks a lot!
Ivan
On Fri, Feb 28, 2014 at 5:54 PM, <forge-dev@lists.jboss.org> wrote:
Ivan,
Your install() method is returning false; Make sure to return
isInstalled() instead.
Posted by forums
Original post: https://community.jboss.org/message/860263#860263
_______________________________________________
forge-dev mailing list
https://lists.jboss.org/mailman/listinfo/forge-dev
-
att1.html.zip 649 bytes
-