選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

BaseOSGiTestCase.java 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* ====================================================================
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. ==================================================================== */
  15. package org.apache.poi.osgi;
  16. import org.ops4j.pax.exam.Configuration;
  17. import org.ops4j.pax.exam.Option;
  18. import org.osgi.framework.BundleContext;
  19. import javax.inject.Inject;
  20. import java.io.File;
  21. import java.io.IOException;
  22. import static org.ops4j.pax.exam.CoreOptions.*;
  23. /**
  24. * Test to ensure that all our main formats can create, write
  25. * and read back in, when running under OSGi
  26. */
  27. public class BaseOSGiTestCase {
  28. @Inject
  29. private BundleContext bc;
  30. @Configuration
  31. public Option[] configuration() throws IOException {
  32. String bundlePath = System.getProperty("bundle.filename");
  33. if(bundlePath == null){
  34. throw new IllegalStateException("-Dbundle.filename property is not set.");
  35. }
  36. return options(
  37. junitBundles(),
  38. bundle(new File(bundlePath).toURI().toURL().toString()));
  39. }
  40. }