@Test(expected = IOException.class) public void getNoneP2FileFromJarInputStream() throws AttributeParsingException, IOException { when(tempBlob.get()).thenAnswer((a) -> getClass().getResourceAsStream(NON_P2_JAR)); underTest.getAttributesFromBlob(tempBlob, "zip"); }
@Override public P2Attributes getAttributesFromBlob(final TempBlob tempBlob, final String extension) throws IOException, AttributeParsingException { Builder p2AttributesBuilder = P2Attributes.builder(); Optional<Manifest> manifestJarEntity = manifestJarExtractor.getSpecificEntity(tempBlob, extension, MANIFEST_FILE_PREFIX); if (manifestJarEntity.isPresent()) { Attributes mainManifestAttributes = manifestJarEntity.get().getMainAttributes(); String bundleLocalizationValue = mainManifestAttributes.getValue("Bundle-Localization"); Optional<PropertyResourceBundle> propertiesOpt = propertyParser.getBundleProperties(tempBlob, extension, bundleLocalizationValue == null ? BUNDLE_PROPERTIES : bundleLocalizationValue); p2AttributesBuilder .componentName(normalizeName(propertyParser .extractValueFromProperty(mainManifestAttributes.getValue("Bundle-SymbolicName"), propertiesOpt))) .pluginName( propertyParser.extractValueFromProperty(mainManifestAttributes.getValue("Bundle-Name"), propertiesOpt)) .componentVersion( propertyParser .extractValueFromProperty(mainManifestAttributes.getValue("Bundle-Version"), propertiesOpt)); } return p2AttributesBuilder.build(); }
AttributesParserManifest implements AttributesParser { @Override public P2Attributes getAttributesFromBlob(final TempBlob tempBlob, final String extension) throws IOException, AttributeParsingException { Builder p2AttributesBuilder = P2Attributes.builder(); Optional<Manifest> manifestJarEntity = manifestJarExtractor.getSpecificEntity(tempBlob, extension, MANIFEST_FILE_PREFIX); if (manifestJarEntity.isPresent()) { Attributes mainManifestAttributes = manifestJarEntity.get().getMainAttributes(); String bundleLocalizationValue = mainManifestAttributes.getValue("Bundle-Localization"); Optional<PropertyResourceBundle> propertiesOpt = propertyParser.getBundleProperties(tempBlob, extension, bundleLocalizationValue == null ? BUNDLE_PROPERTIES : bundleLocalizationValue); p2AttributesBuilder .componentName(normalizeName(propertyParser .extractValueFromProperty(mainManifestAttributes.getValue("Bundle-SymbolicName"), propertiesOpt))) .pluginName( propertyParser.extractValueFromProperty(mainManifestAttributes.getValue("Bundle-Name"), propertiesOpt)) .componentVersion( propertyParser .extractValueFromProperty(mainManifestAttributes.getValue("Bundle-Version"), propertiesOpt)); } return p2AttributesBuilder.build(); } }
AttributesParserManifest implements AttributesParser { @Override public P2Attributes getAttributesFromBlob(final TempBlob tempBlob, final String extension) throws IOException, AttributeParsingException { Builder p2AttributesBuilder = P2Attributes.builder(); Optional<Manifest> manifestJarEntity = manifestJarExtractor.getSpecificEntity(tempBlob, extension, MANIFEST_FILE_PREFIX); if (manifestJarEntity.isPresent()) { Attributes mainManifestAttributes = manifestJarEntity.get().getMainAttributes(); String bundleLocalizationValue = mainManifestAttributes.getValue("Bundle-Localization"); Optional<PropertyResourceBundle> propertiesOpt = propertyParser.getBundleProperties(tempBlob, extension, bundleLocalizationValue == null ? BUNDLE_PROPERTIES : bundleLocalizationValue); p2AttributesBuilder .componentName(normalizeName(propertyParser .extractValueFromProperty(mainManifestAttributes.getValue("Bundle-SymbolicName"), propertiesOpt))) .pluginName( propertyParser.extractValueFromProperty(mainManifestAttributes.getValue("Bundle-Name"), propertiesOpt)) .componentVersion( propertyParser .extractValueFromProperty(mainManifestAttributes.getValue("Bundle-Version"), propertiesOpt)); } return p2AttributesBuilder.build(); } @Inject  AttributesParserManifest(final TempBlobConverter tempBlobConverter, final PropertyParser propertyParser); }
AttributesParserManifest implements AttributesParser { @Override public P2Attributes getAttributesFromBlob(final TempBlob tempBlob, final String extension) throws IOException, AttributeParsingException { Builder p2AttributesBuilder = P2Attributes.builder(); Optional<Manifest> manifestJarEntity = manifestJarExtractor.getSpecificEntity(tempBlob, extension, MANIFEST_FILE_PREFIX); if (manifestJarEntity.isPresent()) { Attributes mainManifestAttributes = manifestJarEntity.get().getMainAttributes(); String bundleLocalizationValue = mainManifestAttributes.getValue("Bundle-Localization"); Optional<PropertyResourceBundle> propertiesOpt = propertyParser.getBundleProperties(tempBlob, extension, bundleLocalizationValue == null ? BUNDLE_PROPERTIES : bundleLocalizationValue); p2AttributesBuilder .componentName(normalizeName(propertyParser .extractValueFromProperty(mainManifestAttributes.getValue("Bundle-SymbolicName"), propertiesOpt))) .pluginName( propertyParser.extractValueFromProperty(mainManifestAttributes.getValue("Bundle-Name"), propertiesOpt)) .componentVersion( propertyParser .extractValueFromProperty(mainManifestAttributes.getValue("Bundle-Version"), propertiesOpt)); } return p2AttributesBuilder.build(); } @Inject  AttributesParserManifest(final TempBlobConverter tempBlobConverter, final PropertyParser propertyParser); @Override P2Attributes getAttributesFromBlob(final TempBlob tempBlob, final String extension); }
AttributesParserManifest implements AttributesParser { @Override public P2Attributes getAttributesFromBlob(final TempBlob tempBlob, final String extension) throws IOException, AttributeParsingException { Builder p2AttributesBuilder = P2Attributes.builder(); Optional<Manifest> manifestJarEntity = manifestJarExtractor.getSpecificEntity(tempBlob, extension, MANIFEST_FILE_PREFIX); if (manifestJarEntity.isPresent()) { Attributes mainManifestAttributes = manifestJarEntity.get().getMainAttributes(); String bundleLocalizationValue = mainManifestAttributes.getValue("Bundle-Localization"); Optional<PropertyResourceBundle> propertiesOpt = propertyParser.getBundleProperties(tempBlob, extension, bundleLocalizationValue == null ? BUNDLE_PROPERTIES : bundleLocalizationValue); p2AttributesBuilder .componentName(normalizeName(propertyParser .extractValueFromProperty(mainManifestAttributes.getValue("Bundle-SymbolicName"), propertiesOpt))) .pluginName( propertyParser.extractValueFromProperty(mainManifestAttributes.getValue("Bundle-Name"), propertiesOpt)) .componentVersion( propertyParser .extractValueFromProperty(mainManifestAttributes.getValue("Bundle-Version"), propertiesOpt)); } return p2AttributesBuilder.build(); } @Inject  AttributesParserManifest(final TempBlobConverter tempBlobConverter, final PropertyParser propertyParser); @Override P2Attributes getAttributesFromBlob(final TempBlob tempBlob, final String extension);  }