Moved "ESH-INF/" folders to "OH-INF/" folders (#1328)
* Moved ESH-INF folders to OH-INF folders Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>pull/1332/head
parent
cc702266fe
commit
08da8de5cf
|
@ -79,7 +79,7 @@ public abstract class AbstractResourceBundleProvider<E> {
|
||||||
* This static field provides a root directory for automation object resources in the bundle resources.
|
* This static field provides a root directory for automation object resources in the bundle resources.
|
||||||
* It is common for all resources - {@link ModuleType}s, {@link RuleTemplate}s and {@link Rule}s.
|
* It is common for all resources - {@link ModuleType}s, {@link RuleTemplate}s and {@link Rule}s.
|
||||||
*/
|
*/
|
||||||
protected static final String ROOT_DIRECTORY = "ESH-INF/automation";
|
protected static final String ROOT_DIRECTORY = "OH-INF/automation";
|
||||||
|
|
||||||
protected @Nullable ConfigI18nLocalizationService configI18nService;
|
protected @Nullable ConfigI18nLocalizationService configI18nService;
|
||||||
|
|
||||||
|
@ -97,10 +97,10 @@ public abstract class AbstractResourceBundleProvider<E> {
|
||||||
* This field is initialized in constructors of any particular provider with specific path for the particular
|
* This field is initialized in constructors of any particular provider with specific path for the particular
|
||||||
* resources from specific type as {@link ModuleType}s, {@link RuleTemplate}s and {@link Rule}s:
|
* resources from specific type as {@link ModuleType}s, {@link RuleTemplate}s and {@link Rule}s:
|
||||||
* <li>for
|
* <li>for
|
||||||
* {@link ModuleType}s it is a "ESH-INF/automation/moduletypes/"
|
* {@link ModuleType}s it is a "OH-INF/automation/moduletypes/"
|
||||||
* <li>for {@link RuleTemplate}s it is a
|
* <li>for {@link RuleTemplate}s it is a
|
||||||
* "ESH-INF/automation/templates/"
|
* "OH-INF/automation/templates/"
|
||||||
* <li>for {@link Rule}s it is a "ESH-INF/automation/rules/"
|
* <li>for {@link Rule}s it is a "OH-INF/automation/rules/"
|
||||||
*/
|
*/
|
||||||
protected final String path;
|
protected final String path;
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ import org.osgi.service.component.annotations.Reference;
|
||||||
public class XmlBindingInfoProvider extends AbstractXmlBasedProvider<String, BindingInfo>
|
public class XmlBindingInfoProvider extends AbstractXmlBasedProvider<String, BindingInfo>
|
||||||
implements BindingInfoProvider, XmlDocumentProviderFactory<BindingInfoXmlResult> {
|
implements BindingInfoProvider, XmlDocumentProviderFactory<BindingInfoXmlResult> {
|
||||||
|
|
||||||
private static final String XML_DIRECTORY = "/ESH-INF/binding/";
|
private static final String XML_DIRECTORY = "/OH-INF/binding/";
|
||||||
public static final String READY_MARKER = "esh.xmlBindingInfo";
|
public static final String READY_MARKER = "esh.xmlBindingInfo";
|
||||||
|
|
||||||
private final BindingI18nLocalizationService bindingI18nService;
|
private final BindingI18nLocalizationService bindingI18nService;
|
||||||
|
|
|
@ -46,7 +46,7 @@ import org.osgi.service.component.annotations.Reference;
|
||||||
public class ConfigXmlConfigDescriptionProvider extends AbstractXmlConfigDescriptionProvider
|
public class ConfigXmlConfigDescriptionProvider extends AbstractXmlConfigDescriptionProvider
|
||||||
implements XmlDocumentProviderFactory<List<ConfigDescription>> {
|
implements XmlDocumentProviderFactory<List<ConfigDescription>> {
|
||||||
|
|
||||||
private static final String XML_DIRECTORY = "/ESH-INF/config/";
|
private static final String XML_DIRECTORY = "/OH-INF/config/";
|
||||||
public static final String READY_MARKER = "esh.xmlConfig";
|
public static final String READY_MARKER = "esh.xmlConfig";
|
||||||
|
|
||||||
private final ConfigI18nLocalizationService configI18nService;
|
private final ConfigI18nLocalizationService configI18nService;
|
||||||
|
|
|
@ -58,7 +58,7 @@ import org.osgi.service.component.annotations.Reference;
|
||||||
public class XmlThingTypeProvider extends AbstractXmlBasedProvider<UID, ThingType>
|
public class XmlThingTypeProvider extends AbstractXmlBasedProvider<UID, ThingType>
|
||||||
implements ThingTypeProvider, XmlDocumentProviderFactory<List<?>> {
|
implements ThingTypeProvider, XmlDocumentProviderFactory<List<?>> {
|
||||||
|
|
||||||
private static final String XML_DIRECTORY = "/ESH-INF/thing/";
|
private static final String XML_DIRECTORY = "/OH-INF/thing/";
|
||||||
public static final String READY_MARKER = "esh.xmlThingTypes";
|
public static final String READY_MARKER = "esh.xmlThingTypes";
|
||||||
|
|
||||||
private final ThingTypeI18nLocalizationService thingTypeI18nLocalizationService;
|
private final ThingTypeI18nLocalizationService thingTypeI18nLocalizationService;
|
||||||
|
|
|
@ -40,7 +40,7 @@ import org.osgi.framework.Bundle;
|
||||||
public class LanguageResourceBundleManager {
|
public class LanguageResourceBundleManager {
|
||||||
|
|
||||||
/** The directory within the bundle where the resource files are searched. */
|
/** The directory within the bundle where the resource files are searched. */
|
||||||
protected static final String RESOURCE_DIRECTORY = "/ESH-INF/i18n";
|
protected static final String RESOURCE_DIRECTORY = "/OH-INF/i18n";
|
||||||
|
|
||||||
/** The file pattern to filter out resource files. */
|
/** The file pattern to filter out resource files. */
|
||||||
private static final String RESOURCE_FILE_PATTERN = "*.properties";
|
private static final String RESOURCE_FILE_PATTERN = "*.properties";
|
||||||
|
|
|
@ -47,18 +47,18 @@ public class ResourceBundleClassLoaderTest {
|
||||||
@Test
|
@Test
|
||||||
public void testName() throws Exception {
|
public void testName() throws Exception {
|
||||||
Path tmp = Files.createTempDirectory("tmp");
|
Path tmp = Files.createTempDirectory("tmp");
|
||||||
URL hostPropertiesURL = createTmpTestPropetiesFile(tmp, "host/ESH-INF/i18n/test.properties");
|
URL hostPropertiesURL = createTmpTestPropetiesFile(tmp, "host/OH-INF/i18n/test.properties");
|
||||||
URL fragmentPropertiesURL = createTmpTestPropetiesFile(tmp, "fragment/ESH-INF/i18n/test.properties");
|
URL fragmentPropertiesURL = createTmpTestPropetiesFile(tmp, "fragment/OH-INF/i18n/test.properties");
|
||||||
|
|
||||||
Bundle bundleMock = mock(Bundle.class);
|
Bundle bundleMock = mock(Bundle.class);
|
||||||
when(bundleMock.findEntries(any(), any(), anyBoolean()))
|
when(bundleMock.findEntries(any(), any(), anyBoolean()))
|
||||||
.thenAnswer(answer -> Collections.enumeration(Arrays.asList(hostPropertiesURL, fragmentPropertiesURL)));
|
.thenAnswer(answer -> Collections.enumeration(Arrays.asList(hostPropertiesURL, fragmentPropertiesURL)));
|
||||||
when(bundleMock.getEntry(any())).thenReturn(hostPropertiesURL);
|
when(bundleMock.getEntry(any())).thenReturn(hostPropertiesURL);
|
||||||
|
|
||||||
ResourceBundleClassLoader classloader = new ResourceBundleClassLoader(bundleMock, "/ESH-INF/i18n",
|
ResourceBundleClassLoader classloader = new ResourceBundleClassLoader(bundleMock, "/OH-INF/i18n",
|
||||||
"*.properties");
|
"*.properties");
|
||||||
|
|
||||||
List<URL> propertiesURLs = Collections.list(bundleMock.findEntries("/ESH-INF/i18n", "*.properties", true));
|
List<URL> propertiesURLs = Collections.list(bundleMock.findEntries("/OH-INF/i18n", "*.properties", true));
|
||||||
|
|
||||||
assertEquals(2, propertiesURLs.size());
|
assertEquals(2, propertiesURLs.size());
|
||||||
assertTrue(propertiesURLs.contains(hostPropertiesURL));
|
assertTrue(propertiesURLs.contains(hostPropertiesURL));
|
||||||
|
|
|
@ -62,7 +62,7 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This tests the RuleEngineImpl and the import from JSON resources contained in the ESH-INF folder.
|
* This tests the RuleEngineImpl and the import from JSON resources contained in the OH-INF folder.
|
||||||
* This test must be run first otherwise imported rules will be cleared.
|
* This test must be run first otherwise imported rules will be cleared.
|
||||||
*
|
*
|
||||||
* @author Benedikt Niehues - Initial contribution
|
* @author Benedikt Niehues - Initial contribution
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -34,7 +34,7 @@ public class ScopeTest extends JavaOSGiTest {
|
||||||
|
|
||||||
private ScriptEngine engine;
|
private ScriptEngine engine;
|
||||||
|
|
||||||
private final String path = "ESH-INF/automation/jsr223/";
|
private final String path = "OH-INF/automation/jsr223/";
|
||||||
private final String workingFile = "scopeWorking.js";
|
private final String workingFile = "scopeWorking.js";
|
||||||
private final String failureFile = "scopeFailure.js";
|
private final String failureFile = "scopeFailure.js";
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue