@Before can I use it for initialization
In pax exam I want certain things to be common for all the test function. For doing this i have used @Before, problem in using @Before method is that it will get called before each test method. Is there way to tackle this problem. Is there some annotations available in pax exam for solving this issue.
@Before
public void init() throws Exception{
featuresService.installFeature("hibernate");
featuresService.installFeature("hibernate-validator");
bundleContext.installBundle("wrap:mvn:osgi/osgi/3.0.1").start();
bundleContext.installBundle("wrap:mvn:javax.xml/xml/3.1.0").start();
bundleContext.installBundle("wrap:mvn:commons-dbcp/commons-dbcp/1.2.2").start();
bundleContext.installBundle("wrap:mvn:commons-pool/commons-pool/1.3").start();
bundleContext.installBundle("wrap:mvn:commons-lang/commons-lang/2.3").start();
}
junit osgi apache-karaf karaf pax-exam
add a comment |
In pax exam I want certain things to be common for all the test function. For doing this i have used @Before, problem in using @Before method is that it will get called before each test method. Is there way to tackle this problem. Is there some annotations available in pax exam for solving this issue.
@Before
public void init() throws Exception{
featuresService.installFeature("hibernate");
featuresService.installFeature("hibernate-validator");
bundleContext.installBundle("wrap:mvn:osgi/osgi/3.0.1").start();
bundleContext.installBundle("wrap:mvn:javax.xml/xml/3.1.0").start();
bundleContext.installBundle("wrap:mvn:commons-dbcp/commons-dbcp/1.2.2").start();
bundleContext.installBundle("wrap:mvn:commons-pool/commons-pool/1.3").start();
bundleContext.installBundle("wrap:mvn:commons-lang/commons-lang/2.3").start();
}
junit osgi apache-karaf karaf pax-exam
actually this is a possible way of doing, but the given solution from Jérémie is a better solution. Maybe this sample will help too: github.com/ops4j/org.ops4j.pax.web/blob/master/pax-web-itest/…
– Achim Nierbeck
Feb 17 '16 at 8:12
add a comment |
In pax exam I want certain things to be common for all the test function. For doing this i have used @Before, problem in using @Before method is that it will get called before each test method. Is there way to tackle this problem. Is there some annotations available in pax exam for solving this issue.
@Before
public void init() throws Exception{
featuresService.installFeature("hibernate");
featuresService.installFeature("hibernate-validator");
bundleContext.installBundle("wrap:mvn:osgi/osgi/3.0.1").start();
bundleContext.installBundle("wrap:mvn:javax.xml/xml/3.1.0").start();
bundleContext.installBundle("wrap:mvn:commons-dbcp/commons-dbcp/1.2.2").start();
bundleContext.installBundle("wrap:mvn:commons-pool/commons-pool/1.3").start();
bundleContext.installBundle("wrap:mvn:commons-lang/commons-lang/2.3").start();
}
junit osgi apache-karaf karaf pax-exam
In pax exam I want certain things to be common for all the test function. For doing this i have used @Before, problem in using @Before method is that it will get called before each test method. Is there way to tackle this problem. Is there some annotations available in pax exam for solving this issue.
@Before
public void init() throws Exception{
featuresService.installFeature("hibernate");
featuresService.installFeature("hibernate-validator");
bundleContext.installBundle("wrap:mvn:osgi/osgi/3.0.1").start();
bundleContext.installBundle("wrap:mvn:javax.xml/xml/3.1.0").start();
bundleContext.installBundle("wrap:mvn:commons-dbcp/commons-dbcp/1.2.2").start();
bundleContext.installBundle("wrap:mvn:commons-pool/commons-pool/1.3").start();
bundleContext.installBundle("wrap:mvn:commons-lang/commons-lang/2.3").start();
}
junit osgi apache-karaf karaf pax-exam
junit osgi apache-karaf karaf pax-exam
edited Nov 21 '18 at 3:08
Cœur
18.6k9110150
18.6k9110150
asked Feb 16 '16 at 7:36
CharityCharity
115114
115114
actually this is a possible way of doing, but the given solution from Jérémie is a better solution. Maybe this sample will help too: github.com/ops4j/org.ops4j.pax.web/blob/master/pax-web-itest/…
– Achim Nierbeck
Feb 17 '16 at 8:12
add a comment |
actually this is a possible way of doing, but the given solution from Jérémie is a better solution. Maybe this sample will help too: github.com/ops4j/org.ops4j.pax.web/blob/master/pax-web-itest/…
– Achim Nierbeck
Feb 17 '16 at 8:12
actually this is a possible way of doing, but the given solution from Jérémie is a better solution. Maybe this sample will help too: github.com/ops4j/org.ops4j.pax.web/blob/master/pax-web-itest/…
– Achim Nierbeck
Feb 17 '16 at 8:12
actually this is a possible way of doing, but the given solution from Jérémie is a better solution. Maybe this sample will help too: github.com/ops4j/org.ops4j.pax.web/blob/master/pax-web-itest/…
– Achim Nierbeck
Feb 17 '16 at 8:12
add a comment |
1 Answer
1
active
oldest
votes
It's not possible now to have such behavior in a test run by PaxExam, but your init
method could be easyly replaced by Option
for the provisionning of your container.
For example :
features(maven().groupId("org.apache.karaf.assemblies.features")
.artifactId("enterprise").type("xml").classifier("features")
.versionAsInProject(), "hibernate", "hibernate-validator")
or
wrappedBundle(mavenBundle("commons-dbcp", "commons-dbcp", "1.2.2"))
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f35426460%2fbefore-can-i-use-it-for-initialization%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
It's not possible now to have such behavior in a test run by PaxExam, but your init
method could be easyly replaced by Option
for the provisionning of your container.
For example :
features(maven().groupId("org.apache.karaf.assemblies.features")
.artifactId("enterprise").type("xml").classifier("features")
.versionAsInProject(), "hibernate", "hibernate-validator")
or
wrappedBundle(mavenBundle("commons-dbcp", "commons-dbcp", "1.2.2"))
add a comment |
It's not possible now to have such behavior in a test run by PaxExam, but your init
method could be easyly replaced by Option
for the provisionning of your container.
For example :
features(maven().groupId("org.apache.karaf.assemblies.features")
.artifactId("enterprise").type("xml").classifier("features")
.versionAsInProject(), "hibernate", "hibernate-validator")
or
wrappedBundle(mavenBundle("commons-dbcp", "commons-dbcp", "1.2.2"))
add a comment |
It's not possible now to have such behavior in a test run by PaxExam, but your init
method could be easyly replaced by Option
for the provisionning of your container.
For example :
features(maven().groupId("org.apache.karaf.assemblies.features")
.artifactId("enterprise").type("xml").classifier("features")
.versionAsInProject(), "hibernate", "hibernate-validator")
or
wrappedBundle(mavenBundle("commons-dbcp", "commons-dbcp", "1.2.2"))
It's not possible now to have such behavior in a test run by PaxExam, but your init
method could be easyly replaced by Option
for the provisionning of your container.
For example :
features(maven().groupId("org.apache.karaf.assemblies.features")
.artifactId("enterprise").type("xml").classifier("features")
.versionAsInProject(), "hibernate", "hibernate-validator")
or
wrappedBundle(mavenBundle("commons-dbcp", "commons-dbcp", "1.2.2"))
answered Feb 16 '16 at 8:53
Jérémie BJérémie B
7,68311434
7,68311434
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f35426460%2fbefore-can-i-use-it-for-initialization%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
actually this is a possible way of doing, but the given solution from Jérémie is a better solution. Maybe this sample will help too: github.com/ops4j/org.ops4j.pax.web/blob/master/pax-web-itest/…
– Achim Nierbeck
Feb 17 '16 at 8:12