/* * Copyright (c) 2012-2015 Savoir Technologies, Inc. * * Licensed 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * 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. */ package com.savoirtech.hecate.karaf.itest; import com.savoirtech.hecate.osgi.example.PersonRepository; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.Configuration; import org.ops4j.pax.exam.Option; import org.ops4j.pax.exam.ProbeBuilder; import org.ops4j.pax.exam.TestProbeBuilder; import org.ops4j.pax.exam.junit.PaxExam; import org.ops4j.pax.exam.karaf.options.LogLevelOption; import org.osgi.framework.Constants; import javax.inject.Inject; import java.io.File; import static org.ops4j.pax.exam.CoreOptions.*; import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.*; @RunWith(PaxExam.class) public class HecateFeaturesIT extends Assert { //---------------------------------------------------------------------------------------------------------------------- // Fields //---------------------------------------------------------------------------------------------------------------------- @Inject private PersonRepository personRepository; //---------------------------------------------------------------------------------------------------------------------- // Other Methods //---------------------------------------------------------------------------------------------------------------------- @Configuration public final Option[] config() { final String projectVersion = System.getProperty("project.version"); return options( junitBundles(), karafDistributionConfiguration() .frameworkUrl(maven().groupId("org.apache.karaf").artifactId("apache-karaf").type("tar.gz").version("3.0.3")) .unpackDirectory(new File("target/karaf")), systemTimeout(120000), keepRuntimeFolder(), features(maven().groupId("com.savoirtech.hecate.karaf").artifactId("hecate").version(projectVersion).classifier("features").type("xml"), "hecate", "hecate-osgi-example"), configureConsole().ignoreLocalConsole(), logLevel(LogLevelOption.LogLevel.INFO)); } @ProbeBuilder public TestProbeBuilder probeConfiguration(TestProbeBuilder probe) { probe.setHeader(Constants.DYNAMICIMPORT_PACKAGE, "*"); return probe; } @Test public void testHecateFeature() { assertNotNull(personRepository.findBySsn("123456789")); } }