Bug 742617 - negative test on BundleManager.createBundleVersionViaByteArray() with empty byte array produces misleading error message
Summary: negative test on BundleManager.createBundleVersionViaByteArray() with empty b...
Keywords:
Status: NEW
Alias: None
Product: RHQ Project
Classification: Other
Component: CLI
Version: 4.1
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Nobody
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-09-30 19:07 UTC by Mike Foley
Modified: 2022-03-31 04:28 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Embargoed:


Attachments (Terms of Use)

Description Mike Foley 2011-09-30 19:07:56 UTC
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.