Bug 742617 - negative test on BundleManager.createBundleVersionViaByteArray() with empty byte array produces misleading error message
negative test on BundleManager.createBundleVersionViaByteArray() with empty b...
Status: NEW
Product: RHQ Project
Classification: Other
Component: CLI (Show other bugs)
4.1
Unspecified Unspecified
medium Severity medium (vote)
: ---
: ---
Assigned To: RHQ Project Maintainer
Mike Foley
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2011-09-30 15:07 EDT by Mike Foley
Modified: 2011-10-05 10:40 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Mike Foley 2011-09-30 15:07:56 EDT
Description of problem:  negative test on BundleManager.createBundleVersionViaByteArray() with empty byte array produces misleading error message.  


Version-Release number of selected component (if applicable):


How reproducible:
100%

  
Actual results:
[Warning] java.lang.IllegalStateException: There is no bundle name


Expected results:
Byte[] is empty

Additional info:

var bundleName = 'mikesbundle2';
var bundleDistroV1Path = '/home/mfoley/exampleBundles/bundle1.zip';

// delete the test bundle if it exists
var bc = new BundleCriteria();
print("Bundle Criteria Created\n")
bc.addFilterName(bundleName);
print("Bundle filter created\n")
var bundles = BundleManager.findBundlesByCriteria(bc);

if (null != bundles  && bundles.size() > 0 ) {
    print("\nDeleting [" + bundleName + "] to re-run sample scripts...")
   BundleManager.deleteBundle(bundles.get(0).getId());  // this is not working for me ????
 }

// create bundleVersion 1.0 for the sample bundle
var distributionFile = new java.io.File(bundleDistroV1Path);
distributionFile = new java.io.File(distributionFile.getAbsolutePath());
Assert.assertTrue(distributionFile.exists(), "Missing ant bundle distribution file: " + distributionFile);

theBytes = new Array();
// commenting out for negative testtheBytes = org.rhq.core.util.stream.StreamUtil.slurp(new java.io.FileInputStream(distributionFile));
var bundleVersion1 = BundleManager.createBundleVersionViaByteArray(theBytes);

print("\nCreated " + bundleVersion1 + "!")

Note You need to log in before you can comment on or make changes to this bug.