@Test public void testGetApplicationTags() throws Exception { Configuration configuration = new Configuration(); FileSystem fs = FileSystem.getLocal(configuration); SliderFileSystem sliderFileSystem = new SliderFileSystem(fs, configuration); AgentClientProvider provider = new AgentClientProvider(null); String zipFileName = TestUtility.createAppPackage( folder, "testpkg", "test.zip", "target/test-classes/org/apache/slider/common/tools/test"); Set<String> tags = provider.getApplicationTags(sliderFileSystem, zipFileName); assert tags != null; assert !tags.isEmpty(); assert tags.contains("Name: STORM"); assert tags.contains("Description: Apache Hadoop Stream processing framework"); assert tags.contains("Version: 0.9.1.2.1"); }
@Override public Set<String> getApplicationTags(SliderFileSystem fileSystem, String appDef) throws SliderException { Set<String> tags; Metainfo metaInfo = getMetainfo(fileSystem, appDef); if (metaInfo == null) { log.error("Error retrieving metainfo from {}", appDef); throw new SliderException("Error parsing metainfo file, possibly bad structure."); } Application application = metaInfo.getApplication(); tags = new HashSet<String>(); tags.add("Name: " + application.getName()); tags.add("Version: " + application.getVersion()); tags.add("Description: " + SliderUtils.truncate(application.getComment(), 80)); return tags; }
AgentClientProvider extends AbstractClientProvider implements AgentKeys, SliderKeys { @Override public Set<String> getApplicationTags(SliderFileSystem fileSystem, String appDef) throws SliderException { Set<String> tags; Metainfo metaInfo = getMetainfo(fileSystem, appDef); if (metaInfo == null) { log.error("Error retrieving metainfo from {}", appDef); throw new SliderException("Error parsing metainfo file, possibly bad structure."); } Application application = metaInfo.getApplication(); tags = new HashSet<String>(); tags.add("Name: " + application.getName()); tags.add("Version: " + application.getVersion()); tags.add("Description: " + SliderUtils.truncate(application.getComment(), 80)); return tags; } }
AgentClientProvider extends AbstractClientProvider implements AgentKeys, SliderKeys { @Override public Set<String> getApplicationTags(SliderFileSystem fileSystem, String appDef) throws SliderException { Set<String> tags; Metainfo metaInfo = getMetainfo(fileSystem, appDef); if (metaInfo == null) { log.error("Error retrieving metainfo from {}", appDef); throw new SliderException("Error parsing metainfo file, possibly bad structure."); } Application application = metaInfo.getApplication(); tags = new HashSet<String>(); tags.add("Name: " + application.getName()); tags.add("Version: " + application.getVersion()); tags.add("Description: " + SliderUtils.truncate(application.getComment(), 80)); return tags; } protected  AgentClientProvider(Configuration conf); }
AgentClientProvider extends AbstractClientProvider implements AgentKeys, SliderKeys { @Override public Set<String> getApplicationTags(SliderFileSystem fileSystem, String appDef) throws SliderException { Set<String> tags; Metainfo metaInfo = getMetainfo(fileSystem, appDef); if (metaInfo == null) { log.error("Error retrieving metainfo from {}", appDef); throw new SliderException("Error parsing metainfo file, possibly bad structure."); } Application application = metaInfo.getApplication(); tags = new HashSet<String>(); tags.add("Name: " + application.getName()); tags.add("Version: " + application.getVersion()); tags.add("Description: " + SliderUtils.truncate(application.getComment(), 80)); return tags; } protected  AgentClientProvider(Configuration conf); @Override String getName(); @Override List<ProviderRole> getRoles(); @Override //Client void preflightValidateClusterConfiguration(SliderFileSystem sliderFileSystem,
                                                    String clustername,
                                                    Configuration configuration,
                                                    AggregateConf instanceDefinition,
                                                    Path clusterDirPath,
                                                    Path generatedConfDirPath,
                                                    boolean secure); @Override void validateInstanceDefinition(AggregateConf instanceDefinition, SliderFileSystem fs); @Override void prepareAMAndConfigForLaunch(SliderFileSystem fileSystem,
                                          Configuration serviceConf,
                                          AbstractLauncher launcher,
                                          AggregateConf instanceDefinition,
                                          Path snapshotConfDirPath,
                                          Path generatedConfDirPath,
                                          Configuration clientConfExtras,
                                          String libdir,
                                          Path tempPath,
                                          boolean miniClusterTestRun); @Override Set<String> getApplicationTags(SliderFileSystem fileSystem,
                                        String appDef); @Override void processClientOperation(SliderFileSystem fileSystem,
                                     RegistryOperations rops,
                                     Configuration configuration,
                                     String operation,
                                     File clientInstallPath,
                                     File appPackage,
                                     JSONObject config,
                                     String name); }
AgentClientProvider extends AbstractClientProvider implements AgentKeys, SliderKeys { @Override public Set<String> getApplicationTags(SliderFileSystem fileSystem, String appDef) throws SliderException { Set<String> tags; Metainfo metaInfo = getMetainfo(fileSystem, appDef); if (metaInfo == null) { log.error("Error retrieving metainfo from {}", appDef); throw new SliderException("Error parsing metainfo file, possibly bad structure."); } Application application = metaInfo.getApplication(); tags = new HashSet<String>(); tags.add("Name: " + application.getName()); tags.add("Version: " + application.getVersion()); tags.add("Description: " + SliderUtils.truncate(application.getComment(), 80)); return tags; } protected  AgentClientProvider(Configuration conf); @Override String getName(); @Override List<ProviderRole> getRoles(); @Override //Client void preflightValidateClusterConfiguration(SliderFileSystem sliderFileSystem,
                                                    String clustername,
                                                    Configuration configuration,
                                                    AggregateConf instanceDefinition,
                                                    Path clusterDirPath,
                                                    Path generatedConfDirPath,
                                                    boolean secure); @Override void validateInstanceDefinition(AggregateConf instanceDefinition, SliderFileSystem fs); @Override void prepareAMAndConfigForLaunch(SliderFileSystem fileSystem,
                                          Configuration serviceConf,
                                          AbstractLauncher launcher,
                                          AggregateConf instanceDefinition,
                                          Path snapshotConfDirPath,
                                          Path generatedConfDirPath,
                                          Configuration clientConfExtras,
                                          String libdir,
                                          Path tempPath,
                                          boolean miniClusterTestRun); @Override Set<String> getApplicationTags(SliderFileSystem fileSystem,
                                        String appDef); @Override void processClientOperation(SliderFileSystem fileSystem,
                                     RegistryOperations rops,
                                     Configuration configuration,
                                     String operation,
                                     File clientInstallPath,
                                     File appPackage,
                                     JSONObject config,
                                     String name); static final String E_COULD_NOT_READ_METAINFO; }