Bug 742617

Summary: negative test on BundleManager.createBundleVersionViaByteArray() with empty byte array produces misleading error message
Product: [Other] RHQ Project Reporter: Mike Foley <mfoley>
Component: CLIAssignee: Nobody <nobody>
Status: NEW --- QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 4.1CC: hrupp
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
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: --- Target Upstream Version:
Embargoed:

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 + "!")