1 2 Previous Next 22 Replies Latest reply on Aug 14, 2011 10:05 AM by toepi

    Where find Resource Descriptor(s)

    toepi Newbie

      Hello,

       

      I try arqullian to test some jee apps. But I need to add some Resources, e.g. datasource, jms needed by the test, to the appserver, I found a wiki entry, which say it is possible with some like tihs:

      Descriptors.create(DataSourceDescriptor.class)

      but I don't find this class(es). Where can I found this class (shrinkwrap-discriptor doesn't contain this?). Or must I realy create "vendor defined" descriptors for this job? And how can I add this easily? Same with "vendor defined" web and ejb bindings.

       

      An other (stupid) Question: How can I use the complete project result e.g. ejb, war)? I like the idee with shrinkwrap (a very nice api) but sometimes it is very frustrated to add all files (inkl. deplibs), packages and so on to a "virtual" archive when maven have allready done this job.

       

      please help me,

       

      Regards,

      Sebastian

        • 1. Re: Where find Resource Descriptor(s)
          Aliaksei Lahachou Newbie

          To the second question, you may use Maven dependency resolver:

           

          return ShrinkWrap.create(WebArchive.class)

                  .addAsLibraries(DependencyResolvers

                          .use(MavenDependencyResolver.class)

                          .artifact("com.example:utils:1.0.0-SNAPSHOT")

                          .resolveAsFiles());

           

          If you want to use your own artifacts, you have to install them into local repository first. The trick is that artifacts are not generated by the time the tests are executed, because test phase is executed before the package phase.

          1 of 1 people found this helpful
          • 2. Re: Where find Resource Descriptor(s)
            toepi Newbie

            the artifact is not available in the repo and on filesystem, thats the problem, thanks for open my eyes.

             

            the other questions: it is not possible yet (but why it is in the docu?) ... found another discussion about it.

             

            sebastian

            • 3. Re: Where find Resource Descriptor(s)
              Aslak Knutsen Master

              Arquillian supports Descriptor deployment, the problem is there are no Descriptor..

               

              But you can easly create your own, e.g. via a simple:

               

              @Deployment
              public static Descriptor createJDBCResource() {
               return new Descriptor() {
                        public String getDescriptorName() {
                                  return "my-datasource.xml";
                        }
                        public String exportToString() {
                                  return "<xml.....";
                        }
               }
              }
              
              

               

              ish..

               

              But only JBoss 4, 5 and 6 support it.

              1 of 1 people found this helpful
              • 4. Re: Where find Resource Descriptor(s)
                toepi Newbie

                okay "not possible" is wrong, but must wrote all by my self ...  and my target container do not support this stuff! More fun for me

                 

                if I add a ResourceDescriptor (e.g. set/get jndi name) and this must impl. by container it is a way that can go to upstream? and must the result realy xml? I not kow If I found the schema for my target container or can use it to deploy it on this *** ...

                 

                thanks for all your work and support

                • 6. Re: Where find Resource Descriptor(s)
                  toepi Newbie

                  ibm webshpere 7. you think the support a genric way?

                   

                  I try to create a ejb-jar.xml desriptor first (as warmup). And what you think about vendor binding and extensions? e.g. ibm-ejb-jar-bnd.xmi and ibm-ejb-ext.xmi same for aplication.xml?

                   

                  and another big question how add descriptor to the archive?

                  • 7. Re: Where find Resource Descriptor(s)
                    Aslak Knutsen Master

                    Have a look at the ShrinkWrap Descriptors project, and specifically the new SHRINKDESC-54 branch.

                     

                    https://github.com/shrinkwrap/descriptors/tree/SHRINKDESC-54

                     

                    The attempt is to automate the api generation based on the xsd, adding the websphere provider descriptors should be easy..

                     

                    https://issues.jboss.org/browse/SHRINKDESC

                     

                     

                    for adding them to a Archive you can use the StringAsset:

                     

                    war.addResource(new StringAsset(Descriptors.create(WebAppDescriptor.class).exportToString()), "web.xml")

                     

                    Or look at the shrinkwrap-extension-descriptors module, only adds a DescriptorAsset atm to you don't have to deal with the exportToString part, but more to come here.

                    • 8. Re: Where find Resource Descriptor(s)
                      toepi Newbie

                      https://github.com/shrinkwrap/descriptors/tree/SHRINKDESC-54

                       

                       

                      looks great - I looked at master only, I'll try to add ibm stuff to it. But where can I found descriptor for resources (have you a hint for me?)

                       

                      StringAsset is the trick thanks,

                       

                      edit:

                      first attempt has problem with somrthink like this:

                        <xsd:sequence>

                          <xsd:choice minOccurs="0" maxOccurs="1">
                            <xsd:element name="authentication-alias" type="authentication-aliasType" />
                            <xsd:element name="custom-login-configuration" type="custom-login-configurationType" />
                          </xsd:choice>
                        
                          <!-- Default-auth is for backward compatibility and should not be used. -->
                          <xsd:element name="default-auth" minOccurs="0" maxOccurs="1">
                            <xsd:complexType>
                              <xsd:attribute name="userid" type="xsd:string"/>
                              <xsd:attribute name="password" type="xsd:string" />
                            </xsd:complexType>
                          </xsd:element>

                        </xsd:sequence>

                       

                      it generate: public <ResourceRefType<T>> defaultAuth();

                      • 9. Re: Where find Resource Descriptor(s)
                        Aslak Knutsen Master

                        Descriptors for Resources would be the same, if the container support deploying Resource XML files.. if not, then well.. eh..  make it ?

                        • 10. Re: Where find Resource Descriptor(s)
                          toepi Newbie

                          sorry to waste your time.

                           

                          but you 've hung me up now ...

                           

                          you mean write ResourceDescriptor without the appserver in mind and than go to the container and implement a way to deploy it? That's was my first impression but than you show me SHRINKDESC-54 and I think it should be possible to find a more generic way. But I've not found any xsd for deploy a resource.

                          • 11. Re: Where find Resource Descriptor(s)
                            Aslak Knutsen Master

                            SHRINKDESC-54 should give you the foundation to generate any XSD based type, it beeing a Reosurce Descriptor for deployment or Deployment Descriptors alla web.xml.

                             

                            But the question is, does WebSphere have any form of Deployable Resource Descriptors for adding JDBC Resources etc, or is all that only API based ?

                            e.g. can be deployed websphere-jdbc-datasource.xml ?

                            • 12. Re: Where find Resource Descriptor(s)
                              toepi Newbie

                              if webshpere support deployable resource descriptor? I think yes because you can put definitions of datasources into the ear and the datasource "life" with the ear. But if you look at the xml you go crazy ... and not only you ... IBM self is sometimes not able to handle this files correctly and create datasource twich or forget do delete an old definition ... but I have no file her and I do this on my private pc and this will never see RAD ...

                               

                              I try to use the api to deploy the resources, have found a example for an datasource and it work like a charm and it should not be the big problem to get the needed infos from an xml.

                               

                              Off-Topic:

                                  Question about SHRINKDESC-54: is has problems with the IBM xsd's e.g. is doesn't like:

                                      <xsd:complexType name="methodType">
                                              <xsd:attribute name="name" type="xsd:string" />
                                              <xsd:attribute name="params" type="xsd:string" />
                                              <xsd:attribute name="type" use="required">
                                                      <xsd:simpleType>
                                                              <xsd:restriction base="xsd:string">
                                                                      <xsd:enumeration value="UNSPECIFIED"/>
                                                                      <xsd:enumeration value="REMOTE"/>
                                                                      <xsd:enumeration value="HOME"/>
                                                                      <xsd:enumeration value="LOCAL"/>
                                                                      <xsd:enumeration value="LOCAL_HOME"/>
                                                                      <xsd:enumeration value="SERVICE_ENDPOINT"/>
                                                              </xsd:restriction>
                                                      </xsd:simpleType>
                                              </xsd:attribute>
                                              <xsd:attribute name="id" type="xsd:ID" />
                                      </xsd:complexType>

                               

                              is create an enum with "" as name and this more than once ... I not realy understand the current task struktur on jira for it - must I create a new task, leave a comment?

                              • 13. Re: Where find Resource Descriptor(s)
                                Ralf Battenfeld Apprentice

                                Hi Toepi

                                 

                                Can you give me a location were I can find the schema you try to include in the generation process? We are working hard on pushing the official Java EE descriptors. But I am interested to analyze this schema too:-)

                                 

                                Thanks

                                Ralf

                                • 14. Re: Where find Resource Descriptor(s)
                                  toepi Newbie

                                  hi ralf,

                                   

                                  I found the schema in the install folder from websphere, have not seen it in wild and not sure if the are public ... so i'll not post it here or on bugtracker.

                                   

                                  I can send it to you as email (123k as zip)?

                                  1 2 Previous Next