Skip to content

Commit

Permalink
Merge pull request #155 from crapo/GH-154
Browse files Browse the repository at this point in the history
GH-154: Fixed Jena-based processor registration defect.
  • Loading branch information
Andrew Crapo authored Feb 21, 2017
2 parents 3c89436 + ac996d4 commit 6bbafc1
Show file tree
Hide file tree
Showing 15 changed files with 218 additions and 105 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
</extension>
<extension
point="com.ge.research.sadl.sadl_inference_processor">
<sadlImportProcessor
class="com.ge.research.sadl.jena.JenaBasedSadlInferenceProcessor">
</sadlImportProcessor>
<sadlInferenceProcessor
class="com.ge.research.sadl.jena.JenaBasedSadlInferenceProcessor"/>
</extension>
</plugin>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
com.ge.research.sadl.jena.JenaBasedSadlModelProcessor
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
com.ge.research.sadl.jena.JenaBasedSadlImportProcessor
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
com.ge.research.sadl.jena.JenaBasedSadlInferenceProcessor
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/************************************************************************
* Copyright © 2007-2017 - General Electric Company, All Rights Reserved
*
* Project: SADL
*
* Description: The Semantic Application Design Language (SADL) is a
* language for building semantic models and expressing rules that
* capture additional domain knowledge. The SADL-IDE (integrated
* development environment) is a set of Eclipse plug-ins that
* support the editing and testing of semantic models using the
* SADL language.
*
* This software is distributed "AS-IS" without ANY WARRANTIES
* and licensed under the Eclipse Public License - v 1.0
* which is available at http://www.eclipse.org/org/documents/epl-v10.php
*
***********************************************************************/
package com.ge.research.sadl.tests

import com.ge.research.sadl.jena.JenaBasedSadlImportProcessor
import com.ge.research.sadl.jena.JenaBasedSadlInferenceProcessor
import com.ge.research.sadl.jena.JenaBasedSadlModelProcessor
import com.ge.research.sadl.processing.SadlImportProcessorProvider
import com.ge.research.sadl.processing.SadlInferenceProcessorProvider
import com.ge.research.sadl.processing.SadlModelProcessorProvider
import com.google.inject.Inject
import org.eclipse.xtext.testing.InjectWith
import org.eclipse.xtext.testing.XtextRunner
import org.junit.Assert
import org.junit.Test
import org.junit.runner.RunWith

/**
* Test for checking whether any SADL model, inference, and import
* processors are available in the headless case.
*
* <p>
* In this test we check the existence of the Jena-based ones.
* The processors are registered via Java SPI.
*
* @author akos.kitta
*/
@RunWith(XtextRunner)
@InjectWith(SADLInjectorProvider)
class GH_154_CheckProcessorsTest extends Assert {

@Inject
SadlModelProcessorProvider modelProcessorProvider;

@Inject
SadlInferenceProcessorProvider inferenceProcessorProvider

@Inject
SadlImportProcessorProvider importProcessorProvider

@Test
def void checkJenaModelProcessor() {
modelProcessorProvider.allProcessors.filter(JenaBasedSadlModelProcessor).empty.assertFalse;
}

@Test
def void checkJenaInferenceProcessor() {
inferenceProcessorProvider.allProcessors.filter(JenaBasedSadlInferenceProcessor).empty.assertFalse;
}

@Test
def void checkNotNullJenaImportProcessor() {
importProcessorProvider.allProcessors.filter(JenaBasedSadlImportProcessor).empty.assertFalse;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ Require-Bundle: com.ge.research.sadl.ui,
org.eclipse.xtext.testing,
org.eclipse.xtext.junit4,
org.eclipse.xtext.xbase.testing,
org.junit;bundle-version="4.12.0"
org.junit;bundle-version="4.12.0",
com.ge.research.sadl.jena;bundle-version="3.1.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: com.ge.research.sadl.ui.tests;x-internal=true
Import-Package: org.hamcrest.core,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/************************************************************************
* Copyright © 2007-2017 - General Electric Company, All Rights Reserved
*
* Project: SADL
*
* Description: The Semantic Application Design Language (SADL) is a
* language for building semantic models and expressing rules that
* capture additional domain knowledge. The SADL-IDE (integrated
* development environment) is a set of Eclipse plug-ins that
* support the editing and testing of semantic models using the
* SADL language.
*
* This software is distributed "AS-IS" without ANY WARRANTIES
* and licensed under the Eclipse Public License - v 1.0
* which is available at http://www.eclipse.org/org/documents/epl-v10.php
*
***********************************************************************/
package com.ge.research.sadl.ui.tests

import com.ge.research.sadl.jena.JenaBasedSadlImportProcessor
import com.ge.research.sadl.jena.JenaBasedSadlInferenceProcessor
import com.ge.research.sadl.jena.JenaBasedSadlModelProcessor
import com.ge.research.sadl.processing.SadlImportProcessorProvider
import com.ge.research.sadl.processing.SadlInferenceProcessorProvider
import com.ge.research.sadl.processing.SadlModelProcessorProvider
import com.google.inject.Inject
import org.eclipse.core.runtime.Platform
import org.eclipse.xtext.testing.InjectWith
import org.eclipse.xtext.testing.XtextRunner
import org.junit.Assert
import org.junit.BeforeClass
import org.junit.Test
import org.junit.runner.RunWith

/**
* Test for checking whether any SADL model, inference, and import
* processors are available in the Eclipse-based case.
*
* <p>
* In this test we check the existence of the Jena-based ones.
* The processors are registered via Eclipse-based extension points.
*
* @author akos.kitta
*/
@RunWith(XtextRunner)
@InjectWith(SADLUiInjectorProvider)
class GH_154_CheckProcessorsPluginTest extends Assert {

@Inject
SadlModelProcessorProvider modelProcessorProvider;

@Inject
SadlInferenceProcessorProvider inferenceProcessorProvider

@Inject
SadlImportProcessorProvider importProcessorProvider;

@BeforeClass
static def void assertRunningPlatform() {
assertTrue('These tests require a running Eclipse platform.
Execute them as a JUnit Plug-in Test.
If you see this error from Maven, then please configure your POM to use Tycho Surefire correctly for test execution.',
Platform.isRunning);
}

@Test
def void checkJenaModelProcessor() {
modelProcessorProvider.allProcessors.filter(JenaBasedSadlModelProcessor).empty.assertFalse;
}

@Test
def void checkJenaInferenceProcessor() {
inferenceProcessorProvider.allProcessors.filter(JenaBasedSadlInferenceProcessor).empty.assertFalse;
}

@Test
def void checkNotNullJenaImportProcessor() {
importProcessorProvider.allProcessors.filter(JenaBasedSadlImportProcessor).empty.assertFalse;
}

}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ Export-Package: com.ge.research.sadl.ui,
com.ge.research.sadl.ui.labeling,
com.ge.research.sadl.ui.outline,
com.ge.research.sadl.ui.preferences,
com.ge.research.sadl.ui.processing,
com.ge.research.sadl.ui.quickfix,
com.ge.research.sadl.ui.syntaxcoloring,
com.ge.research.sadl.ui.visualize
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
Expand All @@ -23,8 +22,6 @@
import java.util.List;
import java.util.zip.ZipEntry;

import javax.activation.DataSource;

//import org.eclipse.core.filesystem.URIUtil;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
Expand All @@ -38,7 +35,6 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IExecutableExtension;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
Expand All @@ -65,8 +61,6 @@
import com.ge.research.sadl.processing.ISadlImportProcessor;
import com.ge.research.sadl.processing.SadlImportProcessorProvider;
import com.ge.research.sadl.ui.internal.SadlActivator;
import com.ge.research.sadl.ui.processing.ExtensionPointBasedSadlImportProcessorProvider;
import com.ge.research.sadl.utils.ResourceManager;
import com.google.inject.Inject;
import com.google.inject.Injector;

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import java.util.Map
import java.util.ServiceLoader
import org.eclipse.core.runtime.RegistryFactory
import org.eclipse.emf.common.EMFPlugin
import org.eclipse.emf.ecore.resource.Resource
import org.slf4j.LoggerFactory

/**
Expand All @@ -39,9 +38,14 @@ import org.slf4j.LoggerFactory
* the Eclipse platform is not running, it uses the the Java SPI discovery
* approach instead to load 3rd party processor implementations.
*
* @param
* <P> Type of the provided processor.
* @param
* <R> Type of the subject object which is used to provide the processor.
*
* @author akos.kitta
*/
abstract class AbstractSadlProcessorProvider<P> {
abstract class AbstractSadlProcessorProvider<P, R> {

static val LOGGER = LoggerFactory.getLogger(AbstractSadlProcessorProvider);
static val CONFIGURATION_ELEMENT_NAME = 'class';
Expand All @@ -62,9 +66,9 @@ abstract class AbstractSadlProcessorProvider<P> {
}

/**
* Returns with the processor for the given resource argument.
* Returns with the processor for the given subject argument.
*/
protected def P getProcessor(Resource resource);
def P getProcessor(R subject);

/**
* Returns with a view of all available processor instances.
Expand Down
Loading

0 comments on commit 6bbafc1

Please sign in to comment.