<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: localization dependency in unit test in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/localization-dependency-in-unit-test/m-p/323687#M10688</link>
    <description>&lt;P&gt;You're right, the pre-deployment is not played as part of the runtime feature. You can try to add this logic by implementing a new feature for. Here is the code snipset that do the pre-deployment.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;PRE&gt;&lt;CODE&gt; String rootPath = Environment.getDefault().getRuntimeHome().getAbsolutePath();
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/BLOCKQUOTE&gt;
&lt;PRE&gt;&lt;CODE&gt;    File root = new File(rootPath);
    DeploymentPreprocessor processor = new DeploymentPreprocessor(root);
    // initialize
    processor.init();
    // and predeploy
    processor.predeploy();
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 18 Aug 2017 14:08:09 GMT</pubDate>
    <dc:creator>slacoin_Lacoin</dc:creator>
    <dc:date>2017-08-18T14:08:09Z</dc:date>
    <item>
      <title>localization dependency in unit test</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/localization-dependency-in-unit-test/m-p/323686#M10687</link>
      <description>&lt;P&gt;Background: I built component X. Component X has &lt;CODE&gt;OSGI-INF/l10n/messages.properties&lt;/CODE&gt;. In component X, &lt;CODE&gt;ResourceBundle.getBundle&lt;/CODE&gt; works fine when unit testing X in its own project.
Problem: When component X is referenced (via Maven) from separate project Y, Y invokes X, and the call to ResourceBundle.getBundle down inside X brings back a bundle missing the properties defined in X.
I've read the "Understanding Bundles Deployment" docs and looking at the framework code it looks like the &lt;CODE&gt;DeploymentPreprocessor.java&lt;/CODE&gt; class is responsible to process the &lt;CODE&gt;OSGI-INF/deployment-fragment.xml&lt;/CODE&gt; files and merge all the various component properties into a single messages.properties, messages_xx_yy.properties, etc. However, it does not appear that &lt;CODE&gt;DeploymentPreprocessor.java&lt;/CODE&gt; runs in the unit test environment.
I could duplicate the properties X needs in the Y project, so that X doesn't fail. This seems bad. Does anyone have a best practice here? (Or maybe I'm just doing something wrong?)&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2017 14:20:08 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/localization-dependency-in-unit-test/m-p/323686#M10687</guid>
      <dc:creator>Eric_Ace</dc:creator>
      <dc:date>2017-07-27T14:20:08Z</dc:date>
    </item>
    <item>
      <title>Re: localization dependency in unit test</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/localization-dependency-in-unit-test/m-p/323687#M10688</link>
      <description>&lt;P&gt;You're right, the pre-deployment is not played as part of the runtime feature. You can try to add this logic by implementing a new feature for. Here is the code snipset that do the pre-deployment.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;PRE&gt;&lt;CODE&gt; String rootPath = Environment.getDefault().getRuntimeHome().getAbsolutePath();
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/BLOCKQUOTE&gt;
&lt;PRE&gt;&lt;CODE&gt;    File root = new File(rootPath);
    DeploymentPreprocessor processor = new DeploymentPreprocessor(root);
    // initialize
    processor.init();
    // and predeploy
    processor.predeploy();
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Aug 2017 14:08:09 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/localization-dependency-in-unit-test/m-p/323687#M10688</guid>
      <dc:creator>slacoin_Lacoin</dc:creator>
      <dc:date>2017-08-18T14:08:09Z</dc:date>
    </item>
  </channel>
</rss>

