@Test public void unknownPackaging() { ArtifactSizeEnforcerRule enforcer = new ArtifactSizeEnforcerRule(); defaultMockhelper.packaging("UnknownPackageType"); try { String packaging = enforcer.getPackaging(defaultMockhelper); assertTrue(!SUPPORTED_PACKAGE_TYPES.contains(packaging)); } catch (EnforcerRuleException e) { fail("ArtifactSizerEnforcerRule was unable to skip an unknown packing type."); } }
protected String getPackaging(EnforcerRuleHelper helper) throws EnforcerRuleException { String packaging; try { packaging = (String) helper.evaluate(PROJECT_PACKAGING_PROP); } catch (ExpressionEvaluationException e) { throw new EnforcerRuleException(e.getMessage()); } switch (packaging) { case JAR: return JAR; case BUNDLE: return JAR; default: return packaging; } }
ArtifactSizeEnforcerRule implements EnforcerRule { protected String getPackaging(EnforcerRuleHelper helper) throws EnforcerRuleException { String packaging; try { packaging = (String) helper.evaluate(PROJECT_PACKAGING_PROP); } catch (ExpressionEvaluationException e) { throw new EnforcerRuleException(e.getMessage()); } switch (packaging) { case JAR: return JAR; case BUNDLE: return JAR; default: return packaging; } } }
ArtifactSizeEnforcerRule implements EnforcerRule { protected String getPackaging(EnforcerRuleHelper helper) throws EnforcerRuleException { String packaging; try { packaging = (String) helper.evaluate(PROJECT_PACKAGING_PROP); } catch (ExpressionEvaluationException e) { throw new EnforcerRuleException(e.getMessage()); } switch (packaging) { case JAR: return JAR; case BUNDLE: return JAR; default: return packaging; } }  }
ArtifactSizeEnforcerRule implements EnforcerRule { protected String getPackaging(EnforcerRuleHelper helper) throws EnforcerRuleException { String packaging; try { packaging = (String) helper.evaluate(PROJECT_PACKAGING_PROP); } catch (ExpressionEvaluationException e) { throw new EnforcerRuleException(e.getMessage()); } switch (packaging) { case JAR: return JAR; case BUNDLE: return JAR; default: return packaging; } }  @Override void execute(EnforcerRuleHelper helper); @Override boolean isCacheable(); @Override boolean isResultValid(EnforcerRule enforcerRule); @Override String getCacheId(); ArtifactSizeEnforcerRule setMaxArtifactSize(String maxArtifactSize); ArtifactSizeEnforcerRule setArtifactLocation(String artifactLocation); }
ArtifactSizeEnforcerRule implements EnforcerRule { protected String getPackaging(EnforcerRuleHelper helper) throws EnforcerRuleException { String packaging; try { packaging = (String) helper.evaluate(PROJECT_PACKAGING_PROP); } catch (ExpressionEvaluationException e) { throw new EnforcerRuleException(e.getMessage()); } switch (packaging) { case JAR: return JAR; case BUNDLE: return JAR; default: return packaging; } }  @Override void execute(EnforcerRuleHelper helper); @Override boolean isCacheable(); @Override boolean isResultValid(EnforcerRule enforcerRule); @Override String getCacheId(); ArtifactSizeEnforcerRule setMaxArtifactSize(String maxArtifactSize); ArtifactSizeEnforcerRule setArtifactLocation(String artifactLocation); static final String PROJECT_PACKAGING_PROP; static final String PROJECT_ARTIFACT_ID_PROP; static final String PROJECT_VERSION_PROP; static final String PROJECT_BUILD_DIR_PROP; static final String DEFAULT_MAX_ARTIFACT_SIZE; static final String BYTES; static final String MEGA_BYTES; static final String KILO_BYTES; static final String JAR; static final String BUNDLE; static final List<String> SUPPORTED_PACKAGE_TYPES; static final String MAX_FILE_SIZE_EXCEEDED_MSG; static final String DEFAULT_ARTIFACT_INFO_MSG; static final String UNKNOWN_ARTIFACT_SIZE_UNIT_MSG; }