protected void insertPublisherInfoBehavior() {
    loader = new DataLoader(configLocation, executableLocation);

    // configure IExecutableAdvice
    LauncherData launcherData = loader.getLauncherData();
    LaunchingAdvice launchingAdvice = new LaunchingAdvice(launcherData, configSpec);

    ArrayList launchingList = new ArrayList();
    launchingList.add(launchingAdvice);

    ProductFileAdvice productAdvice = null;

    try {
      String productFileLocation =
          TestData.getFile("ProductActionTest", "productFileActionTest.product")
              .toString(); //$NON-NLS-1$ //$NON-NLS-2$
      productAdvice = new ProductFileAdvice(new ProductFile(productFileLocation), configSpec);
      launchingList.add(productAdvice);
    } catch (Exception e) {
      fail("Unable to create product file advice", e); // $NON-NLS-1$
    }

    expect(
            publisherInfo.getAdvice(
                EasyMock.matches(configSpec),
                EasyMock.eq(false),
                (String) EasyMock.anyObject(),
                (Version) EasyMock.anyObject(),
                EasyMock.eq(IExecutableAdvice.class)))
        .andReturn(launchingList)
        .anyTimes();

    // configure IConfigAdvice
    ConfigData configData = loader.getConfigData();
    ConfigAdvice configAdvice = new ConfigAdvice(configData, configSpec);
    ArrayList configList = new ArrayList();
    configList.add(configAdvice);
    configList.add(productAdvice);
    expect(
            publisherInfo.getAdvice(
                EasyMock.matches(configSpec),
                EasyMock.eq(false),
                (String) EasyMock.anyObject(),
                (Version) EasyMock.anyObject(),
                EasyMock.eq(IConfigAdvice.class)))
        .andReturn(configList)
        .anyTimes();

    // setup metadata repository
    IInstallableUnit[] ius = {
      mockIU("foo", null), mockIU("bar", null)
    }; //$NON-NLS-1$ //$NON-NLS-2$

    metadataRepo = new TestMetadataRepository(getAgent(), ius);
    expect(publisherInfo.getMetadataRepository()).andReturn(metadataRepo).anyTimes();
    expect(publisherInfo.getContextMetadataRepository()).andReturn(null).anyTimes();
  }
Пример #2
0
 /**
  * Expects a string that matches the given regular expression. For details, see the EasyMock
  * documentation.
  *
  * @param regex the regular expression.
  * @return <code>null</code>.
  */
 protected final String matches(String regex) {
   return EasyMock.matches(regex);
 }