TOMEE-2301 - add test fo the thread factory service Signed-off-by: brunobat <[email protected]>
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/2aaca111 Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/2aaca111 Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/2aaca111 Branch: refs/heads/master Commit: 2aaca11108805c73cd1b86fb7f0a2cc4af5d92b2 Parents: e96315b Author: brunobat <[email protected]> Authored: Wed Dec 5 15:26:36 2018 +0000 Committer: brunobat <[email protected]> Committed: Wed Dec 5 15:27:04 2018 +0000 ---------------------------------------------------------------------- .../executor/ThreadFactoryServiceTest.java | 53 ++++++++++++++++++++ 1 file changed, 53 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tomee/blob/2aaca111/examples/concurrency-utils/src/test/java/org/superbiz/executor/ThreadFactoryServiceTest.java ---------------------------------------------------------------------- diff --git a/examples/concurrency-utils/src/test/java/org/superbiz/executor/ThreadFactoryServiceTest.java b/examples/concurrency-utils/src/test/java/org/superbiz/executor/ThreadFactoryServiceTest.java new file mode 100644 index 0000000..8518c28 --- /dev/null +++ b/examples/concurrency-utils/src/test/java/org/superbiz/executor/ThreadFactoryServiceTest.java @@ -0,0 +1,53 @@ +package org.superbiz.executor; + +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.EmptyAsset; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +import javax.inject.Inject; +import java.util.concurrent.TimeUnit; +import java.util.logging.Logger; + +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@RunWith(Arquillian.class) +public class ThreadFactoryServiceTest { + + private static final Logger LOGGER = Logger.getLogger(ThreadFactoryServiceTest.class.getSimpleName()); + + @Inject + private ThreadFactoryService factoryService; + + @Deployment() + public static final WebArchive app() { + return ShrinkWrap.create(WebArchive.class, "example.war") + .addClasses(ThreadFactoryService.class) + .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); + } + + @Test + public void asyncTask() throws InterruptedException { + + factoryService.asyncTask(1); + LOGGER.info("Do something else"); + TimeUnit.MILLISECONDS.sleep(200); + } +} \ No newline at end of file
