简体   繁体   English

可以使用脚本调用EAR吗?(在jboss 7上部署了EAR)

[英]Is it possible to call an EAR with a script ?(an deployed EAR on jboss 7)

I would like to write an SVN pre commit hook script that would be able to call an EAR that is deployed on jboss 7. I mean that when the script is executed it would be open the web navigator and call the EAR via the (localhost:8080/NameOfTheEar). 我想编写一个SVN预提交钩子脚本,该脚本能够调用部署在jboss 7上的EAR。我的意思是,执行该脚本后,将打开Web导航器,并通过(localhost: 8080 / NameOfTheEar)。 It is very important to do it in my project so any help would be appreciated. 在我的项目中做到这一点非常重要,因此我们将不胜感激。

EDIT : Thx for the answer. 编辑:Thx为答案。 Some details : The EAR contains my application (in the war module of course) so the action that would do the precommit hook is the same that opening the web browser, writing the "localhost:8080/NameOfTheEar" and clicking on enter. 一些细节:EAR包含我的应用程序(当然是在war模块中),因此执行预提交钩子的操作与打开Web浏览器,编写“ localhost:8080 / NameOfTheEar”并单击enter相同。 would that be possible ?? 那有可能吗?? In few words, when the script is executed => the application (in the EAR) pops up in a web browser 简而言之,执行脚本=>时,应用程序(在EAR中)将在Web浏览器中弹出

Because the limitations of what a preCommit hook can do is based on the language in which you write the hook, you can do just about anything in a preCommit hook. 因为preCommit挂钩可以执行的操作的局限性取决于您编写挂钩的语言,所以您可以在preCommit挂钩中执行几乎任何操作。 Most languages would allow a system call to open a Web Page. 大多数语言将允许系统调用打开网页。 I wouldn't imagine it would prevent the commit from occurring. 我无法想象它将阻止提交的发生。 So there's probably little reason for this to be a preCommit hook. 因此,这几乎没有理由成为preCommit钩子。

However, a preCommit hook runs on the machine hosting the Subversion repository. 但是,preCommit挂钩在托管Subversion存储库的计算机上运行。 A hook with this kind of functionality would only work if the working copy committing the changes is on the same physical box that is hosting the repository. 仅当提交更改的工作副本在托管存储库的同一物理盒上时,具有这种功能的钩子才起作用。 If you have remote clients sending their changes into the repository via svnserve or http, then attempting to display a browser via a preCommit hook will not have any impact on the client machine committing their changes. 如果您有远程客户端通过svnserve或http将其更改发送到存储库中,那么尝试通过preCommit钩子显示浏览器将不会对提交更改的客户端计算机产生任何影响。

I'm not aware of any way to communicate these types of actions back to the client as part of the subversion code itself. 我不知道有任何方法可以将这些类型的动作作为Subversion代码本身的一部分传达回客户端。 What it sounds like you want is a client-side hook. 听起来像您想要的是客户端挂钩。 TortoiseSVN has a way to define client-side hooks , but that is specific to TortoiseSVN and is not a repository-based preCommit. TortoiseSVN具有一种定义客户端挂钩的方法 ,但这是特定于TortoiseSVN的方法,而不是基于存储库的preCommit。 Aliasing in Linux/Unix environments would also be a client-side approach as well. Linux / Unix环境中的别名也将是一种客户端方法。

It's pretty easy to write a pre commit hook that hits a web page (which seems to be most of what you're asking for). 编写一个可以击中网页的预提交钩子是很容易的(这似乎是您所要求的大部分)。 As @EdH says, you pretty much have your choice of language and method for hitting the web page. 正如@EdH所说,您几乎可以选择访问网页的语言和方法。

You could, for instance, write a shell script that uses curl or wget to hit the page. 例如,您可以编写一个使用curl或wget来访问页面的shell脚本。 Clicking the button could be a bit tricker, depending on what the button does. 单击按钮可能会有些麻烦,具体取决于按钮的功能。

If you can simulate the button press by passing the correct parameters to the page (and maybe using POST instead of GET if necessary), then it could be fairly easy. 如果可以通过将正确的参数传递给页面来模拟按钮按下(如果需要的话,可以使用POST而不是GET),那么这可能非常简单。

If you actually need to have the button clicked, you could use Selenium , or some other automated UI testing tool to push the button. 如果确实需要单击按钮,则可以使用Selenium或其他一些自动UI测试工具来按下按钮。

If you're into Groovy, check out Geb 如果您喜欢Groovy,请查看Geb

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM