PipelineMetadataService implements ApiRoutable { @GET @TreeResponse public ExportedDescribableModel[] doAgentMetadata() { List<ExportedDescribableModel> models = new ArrayList<>(); for (DeclarativeAgentDescriptor d : DeclarativeAgentDescriptor.all()) { try { DescribableModel<? extends DeclarativeAgent> model = new DescribableModel<>(d.clazz); String symbol = symbolForObject(d); if ("label".equals(symbol)) { symbol = "node"; } models.add(new ExportedDescribableModel(model, symbol)); } catch (NoStaplerConstructorException e) { } } return models.toArray(new ExportedDescribableModel[models.size()]); }  @Override String getUrlName(); @GET String doCrumbInfo(); @GET @TreeResponse ExportedDescribableModel[] doAgentMetadata(); @GET @TreeResponse ExportedToolDescriptor[] doToolMetadata(); @GET @TreeResponse ExportedBuildCondition[] doBuildConditions(); @GET @TreeResponse ExportedPipelineStep[] doWrapperMetadata(); @GET @TreeResponse ExportedPipelineFunction[] doPipelineStepMetadata();  }
@Test public void declarativeAgents() throws Exception { PipelineMetadataService svc = new PipelineMetadataService(); List<ExportedDescribableModel> agents = new ArrayList<>(); agents.addAll(Arrays.asList(svc.doAgentMetadata())); assertFalse(agents.isEmpty()); ExportedDescribableModel m = null; for (ExportedDescribableModel a : agents) { if (a.getType().equals(DockerPipeline.class.getName())) { m = a; } } assertNotNull(m); assertTrue(m.getHasSingleRequiredParameter()); assertTrue(m.getParameters().size() > 0); }