[shrinkwrap-issues] [JBoss JIRA] (SHRINKWRAP-484) improved simpler api's

Caleb Cushing (JIRA) issues at jboss.org
Sat May 31 11:11:15 EDT 2014


     [ https://issues.jboss.org/browse/SHRINKWRAP-484?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Caleb Cushing updated SHRINKWRAP-484:
-------------------------------------

    Description: 
I'd like to see API's such as the following, that just put the file in the right place with the right name on the classpath.

Archive.addPersistenceXML("path/to/persistence.xml")
Archive.addBeansXML("path/to/beans.xml"); // create empty instance if null passed, or maybe just have a variant without a parameter

(obviously corresponding API's using File and such are fine)

having this code, seems silly when the underlying logic could figure it out, once it knows what to return.

{code:java}
    public static JavaArchive testJarH2() {
        return testJar()
              .addPackage( "com.lm.repository.sql" )
              .addAsManifestResource(
                    "wildfly/persistence.xml",
                    "persistence.xml"
              );
    }

    public static WebArchive testWarH2() {
        return testWar()
                .addPackage( "com.lm.repository.sql" )
                .addAsWebInfResource( EmptyAsset.INSTANCE, "beans.xml" )
                .addAsResource(
                        "wildfly/persistence.xml",
                        "META-INF/persistence.xml"
                );
    }
{code}

  was:
I'd like to see API's such as the following, that just put the file in the right place with the right name on the classpath.

Archive.addPersistenceXML("path/to/persistence.xml")
Archive.addBeansXML("path/to/beans.xml"); // create empty instance if null passed, or maybe just have a variant without a parameter

(obviously corresponding API's using File and such are fine)

having this code, seems silly when the underlying logic could figure it out, once it knows what to return.

    public static JavaArchive testJarH2() {
        return testJar()
              .addPackage( "com.lm.repository.sql" )
              .addAsManifestResource(
                    "wildfly/persistence.xml",
                    "persistence.xml"
              );
    }

    public static WebArchive testWarH2() {
        return testWar()
                .addPackage( "com.lm.repository.sql" )
                .addAsWebInfResource( EmptyAsset.INSTANCE, "beans.xml" )
                .addAsResource(
                        "wildfly/persistence.xml",
                        "META-INF/persistence.xml"
                );
    }



> improved simpler api's
> ----------------------
>
>                 Key: SHRINKWRAP-484
>                 URL: https://issues.jboss.org/browse/SHRINKWRAP-484
>             Project: ShrinkWrap
>          Issue Type: Feature Request
>            Reporter: Caleb Cushing
>
> I'd like to see API's such as the following, that just put the file in the right place with the right name on the classpath.
> Archive.addPersistenceXML("path/to/persistence.xml")
> Archive.addBeansXML("path/to/beans.xml"); // create empty instance if null passed, or maybe just have a variant without a parameter
> (obviously corresponding API's using File and such are fine)
> having this code, seems silly when the underlying logic could figure it out, once it knows what to return.
> {code:java}
>     public static JavaArchive testJarH2() {
>         return testJar()
>               .addPackage( "com.lm.repository.sql" )
>               .addAsManifestResource(
>                     "wildfly/persistence.xml",
>                     "persistence.xml"
>               );
>     }
>     public static WebArchive testWarH2() {
>         return testWar()
>                 .addPackage( "com.lm.repository.sql" )
>                 .addAsWebInfResource( EmptyAsset.INSTANCE, "beans.xml" )
>                 .addAsResource(
>                         "wildfly/persistence.xml",
>                         "META-INF/persistence.xml"
>                 );
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.2.3#6260)


More information about the shrinkwrap-issues mailing list