标签: cargo

如何使用Ant连接到远程服务器并启动/停止在该特定服务器上运行的Tomcat?

目的是:

1: connect to a remote server maybe via host: ip , port: 8181
2: stop Tomcat that's running on that server 
3: deploy a .war file 
4: restart tomcat 
Run Code Online (Sandbox Code Playgroud)

java xml ant jmx cargo

3
推荐指数
1
解决办法
3339
查看次数

配置文件的货物复制不起作用

因此,我想做的是自动化我的 JMeter 测试过程,为此,我使用 Cargo 部署到 Tomcat 容器并在那里运行 JMeter 脚本,并使用基于以下描述的 pom:- http: // /www.alexecollins.com/content/jmeter-integration-test-template-pom/ 之后,我付出了很多努力才让它工作。

但是,现在当然为了测试我想使用 testdb 而不是我的实际数据库,为此我需要一个自定义 context.xml (而不是我的生产 context.xml ,一切都可以使用),其中使用 jndi 我定义 jdbc 参数。

因此,我计划有一个 testcontext.xml,我将货物复制到容器中,同时使用货物的复制配置文件选项之类的东西运行 JMeter 测试 - http://cargo.codehaus.org/Custom+File+Configurations。但它似乎不起作用。我已经调试了几个小时了,但无法弄清楚。

我正在粘贴 test-depolyer 模块的 pom 文件,该模块具有要在此处部署的所有其他模块的依赖项:-

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
    <groupId>com.parentname</groupId>
    <artifactId>product-services</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <relativePath>../pom.xml</relativePath>
</parent>
<groupId>com.parentname.product-services</groupId>
<artifactId>test-deployer</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<dependencies>
    <dependency>
        <groupId>com.parentname.product-services</groupId>
        <artifactId>product1-webapp</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <type>war</type>
    </dependency>

</dependencies>

<build>
    <plugins>
        <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
                <execution>
                    <id>default</id>
                    <phase>clean</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                </execution>

            </executions>

            <configuration>
                <tasks>

                    <delete …
Run Code Online (Sandbox Code Playgroud)

spring cargo maven-cargo maven tomcat7

3
推荐指数
1
解决办法
2331
查看次数

货物嵌入tomcat:自定义context.xml

我正在使用 Cargo 在 Tomcat 上自动进行战争部署。但是,我遇到了一个麻烦:我无法用我的自定义替换默认的 tomcat 文件,因为我的文件首先被复制,然后默认被覆盖。我花了几个小时来解决这个问题,但没有任何效果。这是我的 pom.xml

\n\n
    <artifactId>maven-resources-plugin</artifactId>\n                         <executions>\n                             <execution>\n                                 <id>replace-tomcat-users-xml</id>\n                                 <phase>process-test-resources</phase>\n                                 <goals>\n                                     <goal>copy-resources</goal>\n                                 </goals>\n                                 <configuration>\n                                     <outputDirectory>${basedir}/target/apache-tomcat-${version.tomcat}/conf/</outputDirectory>\n                                     <resources>\n                                         <resource>\n                                             <directory>src/test/resources/</directory>\n                                             <includes>\n                                                 <include>context.xml</include>\n                                             </includes>\n                                         </resource>\n                                     </resources>\n                                 </configuration>\n                             </execution>\n                             <execution>\n                                 <id>replace-tomcat-users-xml-cargo</id>\n                                 <phase>process-test-resources</phase>\n                                 <goals>\n                                     <goal>copy-resources</goal>\n                                 </goals>\n                                 <configuration>\n                                     <outputDirectory>${basedir}/target/cargo/installs/tomcat-${version.tomcat}/apache-tomcat-${version.tomcat}</outputDirectory>\n                                     <resources>\n                                         <resource>\n                                             <directory>src/test/resources/</directory>\n                                             <includes>\n                                                 <include>context.xml</include>\n                                             </includes>\n                                         </resource>\n                                     </resources>\n                                 </configuration>\n                             </execution>\n                         </executions>\n                     </plugin>\n
Run Code Online (Sandbox Code Playgroud)\n\n

这是货物使用:

\n\n
<plugin>\n                       <groupId>org.codehaus.cargo</groupId>\n                       <artifactId>cargo-maven2-plugin</artifactId>\n                       <version>1.4.11</version>\n                       <configuration>\n                           <skip>false</skip>\n                           <container>\n                               <containerId>tomcat7x</containerId>\n                               <log>${project.build.directory}/cargo.log</log>\n                               <artifactInstaller>\n                                   <groupId>org.apache.tomcat</groupId>\n                                   <artifactId>tomcat</artifactId>\n                                   <version>${version.tomcat}</version>\n                                   <type>zip</type>\n                               </artifactInstaller>\n                               <systemProperties>\n                                   <tomcat.home.dir>\n                                       ${basedir}/target/cargo/installs/apache-tomcat-${version.tomcat}/apache-tomcat-${version.tomcat}\n                                   </tomcat.home.dir>\n                                   <tomcat.server.home.dir>\n                                       ${basedir}/target/cargo/installs/apache-tomcat-${version.tomcat}/apache-tomcat-${version.tomcat}\n                                   </tomcat.server.home.dir>\n                               </systemProperties>\n                               <dependencies>\n                                   <dependency>\n                                       <groupId>mysql</groupId>\n                                       <artifactId>mysql-connector-java</artifactId>\n                                   </dependency>\n …
Run Code Online (Sandbox Code Playgroud)

java tomcat cargo maven

3
推荐指数
1
解决办法
1万
查看次数

我在哪里可以找到完整的Maven Cargo插件示例进行EJB测试?

对于一些小型JBoss企业应用程序的测试,我想使用JUnit和Maven Cargo插件.(我知道还有JSFUnit,但首先我想仔细看看Cargo.)

是否有一个简单的在线可用示例,我可以将其用作运行JUnit测试的参考,该测试使用Maven Cargo插件使用JBoss(4.2或5.1)调用EJB操作?我已经找到了一些很好的配置介绍,但是我在EJB查找中收到了错误消息,所以看看它应该如何使用会很有帮助.

这是使用InitialContext的测试代码:

public void testEcho() {
   assertEquals("Echo Echo", lookupEchoBeanRemote().Echo("Echo"));
}

private EchoBeanRemote lookupEchoBeanRemote() {
    try {
        Context c = new InitialContext();
        return (EchoBeanRemote) c.lookup("EchoBean/remote");
    } catch (NamingException ne) {
        Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
        throw new RuntimeException(ne);
    }
}
Run Code Online (Sandbox Code Playgroud)

这给出了这个错误:

testEcho(de.betabeans.Echo2Test)  Time elapsed: 0.885 sec  <<< ERROR!
java.lang.reflect.UndeclaredThrowableException
    at $Proxy3.Echo(Unknown Source)
    at de.betabeans.Echo2Test.testEcho(Echo2Test.java:17)
Caused by: java.security.PrivilegedActionException: java.lang.reflect.InvocationTargetException
    at java.security.AccessController.doPrivileged(Native Method)
    at org.jboss.ejb3.security.client.SecurityActions.createSecurityContext(SecurityActions.java:657)
    at org.jboss.ejb3.security.client.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:59)
    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
    at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
    at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62)
    at $Proxy4.invoke(Unknown Source)
    at …
Run Code Online (Sandbox Code Playgroud)

junit jboss maven-2 ejb cargo

2
推荐指数
1
解决办法
7881
查看次数

maven-执行货物失败:开始

我正在尝试cargo在servlet项目中配置自动部署,并且pom.xml文件中包含以下内容:

    <dependency>
      <groupId>org.codehaus.cargo</groupId>
      <artifactId>cargo-core-api-module</artifactId>
      <version>1.4.3</version>
    </dependency>
     <!--
     <dependency>
       <groupId>org.codehaus.cargo</groupId>
       <artifactId>cargo-core-container-tomcat</artifactId>
       <version>1.4.2-SNAPSHOT</version>
    </dependency>
        -->     
    <dependency>         
        <groupId>org.codehaus.cargo</groupId>
        <artifactId>cargo-maven2-plugin</artifactId>
        <version>1.4.2</version>
    </dependency>
    <build>
     <plugins>
       <!-- cargo plugin  -->
  <plugin>
    <groupId>org.codehaus.cargo</groupId>
    <artifactId>cargo-maven2-plugin</artifactId>
    <configuration>
        <container>
            <containerId>tomcat6x</containerId>
            <type>remote</type>
            <systemProperties>
                <cargo.jvmargs>-XX:MaxPermSize=256M -Xmx1024m</cargo.jvmargs>
            </systemProperties>
        </container>
        <configuration>
            <type>runtime</type>
            <properties>
                <cargo.hostname>${remote.hostname}</cargo.hostname>
                <cargo.protocol>${remote.protocol}</cargo.protocol>
                <cargo.servlet.port>9000</cargo.servlet.port>
                <cargo.tomcat.manager.url>http://localhost:9000/manager</cargo.tomcat.manager.url>
                <cargo.remote.username>user</cargo.remote.username>
                <cargo.remote.password>pass</cargo.remote.password>
            </properties>
        </configuration>
        <deployer>
            <type>remote</type>
            <deployables>
                <deployable>
                    <groupId>${groupId}</groupId>
                    <artifactId>${artifactId}</artifactId>
                    <type>war</type>
                    <properties>
                        <context>latest</context>
                    </properties>
                </deployable>
            </deployables>
        </deployer>
    </configuration>
</plugin>
<!-- End cargo plugin -->
     </plugins>
     <build>>
Run Code Online (Sandbox Code Playgroud)

当我尝试通过以下方式开始装货时,出现mvn clean cargo:start构建失败:

[ERROR] Failed …
Run Code Online (Sandbox Code Playgroud)

java deployment servlets cargo maven

1
推荐指数
1
解决办法
5150
查看次数

Cargo 自行激活功能

我有一个依赖于库的二进制文件。在库中,我指定了这些功能:

[features]
default = []
fet = []
Run Code Online (Sandbox Code Playgroud)

我希望功能fet只有在使用功能标志编译时才会被激活。在我的二进制文件中,它Cargo.toml看起来像这样:

[dependencies]
a = { path = "./a" }

[features]
default = []
Run Code Online (Sandbox Code Playgroud)

我没有指定fet的功能Cargo.toml,但是这给了我在我的二进制编译错误:

fn main() {
    if cfg!(feature = "fet") {
        compile_error!("not expected");
    }
}
Run Code Online (Sandbox Code Playgroud)

为什么fet我的二进制文件中的功能仍处于激活状态?我执行了这些命令并得到相同的错误:

cargo run
cargo run --features=default
Run Code Online (Sandbox Code Playgroud)

理想情况下,我希望我的二进制文件从依赖项中激活某些功能,如果它们在cargo run命令中(在--features标志中)明确提及。这可能吗?我希望这能在我的二进制文件中工作Cargo.toml

[features]
default = []
fet = ["a/fet"]
Run Code Online (Sandbox Code Playgroud)

fet如果我运行此命令,则功能将被激活:

cargo run --features=fet
Run Code Online (Sandbox Code Playgroud)

cargo rust

0
推荐指数
1
解决办法
58
查看次数

标签 统计

cargo ×6

java ×3

maven ×3

ant ×1

deployment ×1

ejb ×1

jboss ×1

jmx ×1

junit ×1

maven-2 ×1

maven-cargo ×1

rust ×1

servlets ×1

spring ×1

tomcat ×1

tomcat7 ×1

xml ×1