congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
PackageMaterialMetadataLoader
Code IndexAdd Tabnine to your IDE (free)

How to use
PackageMaterialMetadataLoader
in
com.thoughtworks.go.plugin.access.packagematerial

Best Java code snippets using com.thoughtworks.go.plugin.access.packagematerial.PackageMaterialMetadataLoader (Showing top 9 results out of 315)

origin: gocd/gocd

@Test
public void shouldFetchMetadataOnPluginLoadedCallback() throws Exception {
  PackageMaterialMetadataLoader spy = spy(metadataLoader);
  doNothing().when(spy).fetchRepositoryAndPackageMetaData(pluginDescriptor);
  when(packageRepositoryExtension.canHandlePlugin(pluginDescriptor.id())).thenReturn(true);
  spy.pluginLoaded(pluginDescriptor);
  verify(spy).fetchRepositoryAndPackageMetaData(pluginDescriptor);
}
origin: gocd/gocd

@Test
public void shouldRegisterAsPluginFrameworkStartListener() throws Exception {
  metadataLoader = new PackageMaterialMetadataLoader(pluginManager, packageRepositoryExtension);
  verify(pluginManager).addPluginChangeListener(metadataLoader);
}
origin: gocd/gocd

@Override
public void pluginLoaded(GoPluginDescriptor pluginDescriptor) {
  if (packageRepositoryExtension.canHandlePlugin(pluginDescriptor.id())) {
    fetchRepositoryAndPackageMetaData(pluginDescriptor);
  }
}
origin: gocd/gocd

  @Test
  public void shouldRemoveMetadataOnPluginUnLoadedCallback() throws Exception {
    RepositoryMetadataStore.getInstance().addMetadataFor(pluginDescriptor.id(), new PackageConfigurations());
    PackageMetadataStore.getInstance().addMetadataFor(pluginDescriptor.id(), new PackageConfigurations());
    when(packageRepositoryExtension.canHandlePlugin(pluginDescriptor.id())).thenReturn(true);
    metadataLoader.pluginUnLoaded(pluginDescriptor);
    assertThat(RepositoryMetadataStore.getInstance().getMetadata(pluginDescriptor.id()), is(nullValue()));
    assertThat(PackageMetadataStore.getInstance().getMetadata(pluginDescriptor.id()), is(nullValue()));
  }
}
origin: gocd/gocd

@Test
public void shouldThrowExceptionWhenNullRepositoryConfigurationReturned() {
  when(packageRepositoryExtension.getRepositoryConfiguration(pluginDescriptor.id())).thenReturn(null);
  try {
    metadataLoader.fetchRepositoryAndPackageMetaData(pluginDescriptor);
  } catch (Exception e) {
    assertThat(e.getMessage(), is("Plugin[plugin-id] returned null repository configuration"));
  }
  assertThat(RepositoryMetadataStore.getInstance().getMetadata(pluginDescriptor.id()), nullValue());
  assertThat(PackageMetadataStore.getInstance().getMetadata(pluginDescriptor.id()), nullValue());
}
origin: gocd/gocd

@Test
public void shouldNotTryToFetchMetadataOnPluginLoadedCallback() throws Exception {
  PackageMaterialMetadataLoader spy = spy(metadataLoader);
  when(packageRepositoryExtension.canHandlePlugin(pluginDescriptor.id())).thenReturn(false);
  spy.pluginLoaded(pluginDescriptor);
  verify(spy, never()).fetchRepositoryAndPackageMetaData(pluginDescriptor);
}
origin: gocd/gocd

@Test
public void shouldThrowExceptionWhenNullPackageConfigurationReturned() {
  when(packageRepositoryExtension.getPackageConfiguration(pluginDescriptor.id())).thenReturn(null);
  try {
    metadataLoader.fetchRepositoryAndPackageMetaData(pluginDescriptor);
  } catch (Exception e) {
    assertThat(e.getMessage(), is("Plugin[plugin-id] returned null repository configuration"));
  }
  assertThat(RepositoryMetadataStore.getInstance().getMetadata(pluginDescriptor.id()), nullValue());
  assertThat(PackageMetadataStore.getInstance().getMetadata(pluginDescriptor.id()), nullValue());
}
origin: gocd/gocd

@Before
public void setUp() throws Exception {
  pluginDescriptor = new GoPluginDescriptor("plugin-id", "1.0", null, null, null, true);
  pluginManager = mock(PluginManager.class);
  packageRepositoryExtension = mock(PackageRepositoryExtension.class);
  metadataLoader = new PackageMaterialMetadataLoader(pluginManager, packageRepositoryExtension);
  RepositoryMetadataStore.getInstance().removeMetadata(pluginDescriptor.id());
  PackageMetadataStore.getInstance().removeMetadata(pluginDescriptor.id());
}
origin: gocd/gocd

@Test
public void shouldFetchPackageMetadataForPluginsWhichImplementPackageRepositoryMaterialExtensionPoint() {
  RepositoryConfiguration expectedRepoConfigurations = new RepositoryConfiguration();
  com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration expectedPackageConfigurations = new PackageConfiguration();
  when(packageRepositoryExtension.getRepositoryConfiguration(pluginDescriptor.id())).thenReturn(expectedRepoConfigurations);
  when(packageRepositoryExtension.getPackageConfiguration(pluginDescriptor.id())).thenReturn(expectedPackageConfigurations);
  metadataLoader.fetchRepositoryAndPackageMetaData(pluginDescriptor);
  assertThat(RepositoryMetadataStore.getInstance().getMetadata(pluginDescriptor.id()).getRepositoryConfiguration(), is(expectedRepoConfigurations));
  assertThat(PackageMetadataStore.getInstance().getMetadata(pluginDescriptor.id()).getPackageConfiguration(), is(expectedPackageConfigurations));
}
com.thoughtworks.go.plugin.access.packagematerialPackageMaterialMetadataLoader

Most used methods

  • fetchRepositoryAndPackageMetaData
  • <init>
  • pluginLoaded
  • pluginUnLoaded

Popular in Java

  • Finding current android device location
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • findViewById (Activity)
  • getExternalFilesDir (Context)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now