pub fn verify_provider(provider_info: &ProviderInfo, source: Vec<PactSource>, filter: &FilterInfo,
    consumers: &Vec<String>, options: &VerificationOptions, runtime: &mut Runtime) -> bool {
    let pacts = fetch_pacts(&source, consumers, runtime);

    let mut all_errors: Vec<(String, MismatchResult)> = vec![];
    for pact in pacts {
      match pact {
        Ok(ref res) => {
          let pact = &res.0;
            println!("\nVerifying a pact between {} and {}",
                Style::new().bold().paint(pact.consumer.name.clone()),
                Style::new().bold().paint(pact.provider.name.clone()));

            if pact.interactions.is_empty() {
              println!("         {}", Yellow.paint("WARNING: Pact file has no interactions"));
            } else {
              let errors = verify_pact(provider_info, filter, runtime, pact);
              for error in errors.clone() {
                all_errors.push(error);
              }

              if options.publish {
                publish_result(&errors, &res.1, &options, runtime)
              }
            }
        },
        Err(err) => {
            error!("Failed to load pact - {}", Red.paint(format!("{}", err)));
            all_errors.push((s!("Failed to load pact"), MismatchResult::Error(format!("{}", err), None)));
        }
      }
    };

    if !all_errors.is_empty() {
        println!("\nFailures:\n");

        for (i, &(ref description, ref mismatch)) in all_errors.iter().enumerate() {
          match mismatch {
            &MismatchResult::Error(ref err, _) => println!("{}) {} - {}\n", i, description, err),
            &MismatchResult::Mismatches { ref mismatches, ref expected, ref actual, .. } => {
              let mismatch = mismatches.first().unwrap();
              println!("{}) {}{}", i, description, mismatch.summary());
              for mismatch in mismatches {
                println!("    {}\n", mismatch.ansi_description());
              }

              match mismatch {
                &Mismatch::BodyMismatch{ref path, ..} => display_body_mismatch(expected, actual, path),
                _ => ()
              }
            }
          }
        }

        println!("\nThere were {} pact failures\n", all_errors.len());
      false
    } else {
      true
    }
}
/// Verify the provider with the given pact sources
Verify the provider with the given pact sources
Verify the provider with the given pact sources
pub fn verify_provider(provider_info: &ProviderInfo, source: Vec<PactSource>, filter: &FilterInfo,
    consumers: &Vec<String>, options: &VerificationOptions, runtime: &mut Runtime) -> bool {
    let pacts = fetch_pacts(&source, consumers, runtime);
    let mut all_errors: Vec<(String, MismatchResult)> = vec![];
    for pact in pacts {
      match pact {
        Ok(ref res) => {
          let pact = &res.0;
            println!("\nVerifying a pact between {} and {}",
                Style::new().bold().paint(pact.consumer.name.clone()),
                Style::new().bold().paint(pact.provider.name.clone()));
            if pact.interactions.is_empty() {
              println!("         {}", Yellow.paint("WARNING: Pact file has no interactions"));
            } else {
              let errors = verify_pact(provider_info, filter, runtime, pact);
              for error in errors.clone() {
                all_errors.push(error);
              }
              if options.publish {
                publish_result(&errors, &res.1, &options, runtime)
              }
            }
        },
        Err(err) => {
            error!("Failed to load pact - {}", Red.paint(format!("{}", err)));
            all_errors.push((s!("Failed to load pact"), MismatchResult::Error(format!("{}", err), None)));
        }
      }
    };
    if !all_errors.is_empty() {
        println!("\nFailures:\n");
        for (i, &(ref description, ref mismatch)) in all_errors.iter().enumerate() {
          match mismatch {
            &MismatchResult::Error(ref err, _) => println!("{}) {} - {}\n", i, description, err),
            &MismatchResult::Mismatches { ref mismatches, ref expected, ref actual, .. } => {
              let mismatch = mismatches.first().unwrap();
              println!("{}) {}{}", i, description, mismatch.summary());
              for mismatch in mismatches {
                println!("    {}\n", mismatch.ansi_description());
              }
              match mismatch {
                &Mismatch::BodyMismatch{ref path, ..} => display_body_mismatch(expected, actual, path),
                _ => ()
              }
            }
          }
        }
        println!("\nThere were {} pact failures\n", all_errors.len());
      false
    } else {
      true
    }
}
pub fn verify_provider ( provider_info : & ProviderInfo , source : Vec < PactSource > , filter : & FilterInfo , consumers : & Vec < String > , options : & VerificationOptions , runtime : & mut Runtime ) -> bool { let pacts = fetch_pacts ( & source , consumers , runtime ) ; let mut all_errors : Vec < ( String , MismatchResult ) > = vec ! [ ] ; for pact in pacts { match pact { Ok ( ref res ) => { let pact = & res . 0 ; println ! ( " \n " Style new ( ) bold ( ) paint ( pact consumer name clone ( ) ) Style new ( ) bold ( ) paint ( pact provider name clone ( ) ) ) ; if pact . interactions . is_empty ( ) { println ! ( " " Yellow paint ( " " ) ) ; } else { let errors = verify_pact ( provider_info , filter , runtime , pact ) ; for error in errors . clone ( ) { all_errors . push ( error ) ; } if options . publish { publish_result ( & errors , & res . 1 , & options , runtime ) } } } , Err ( err ) => { error ! ( " " Red paint ( format ( " " err ) ) ) ; all_errors . push ( ( s ! ( " " ) , MismatchResult :: Error ( format ! ( " " err ) , None ) ) ) ; } } } ; if ! all_errors . is_empty ( ) { println ! ( " \n \n " ) ; for ( i , & ( ref description , ref mismatch ) ) in all_errors . iter ( ) . enumerate ( ) { match mismatch { & MismatchResult :: Error ( ref err , _ ) => println ! ( " \n " i description err ) , & MismatchResult :: Mismatches { ref mismatches , ref expected , ref actual , .. } => { let mismatch = mismatches . first ( ) . unwrap ( ) ; println ! ( " " i description mismatch summary ( ) ) ; for mismatch in mismatches { println ! ( " \n " mismatch ansi_description ( ) ) ; } match mismatch { & Mismatch :: BodyMismatch { ref path , .. } => display_body_mismatch ( expected , actual , path ) , _ => ( ) } } } } println ! ( " \n \n " all_errors len ( ) ) ; false } else { true } }
Verify the provider with the given pact sources
Verify the provider with the given pact sources
provider_info
&ProviderInfo
source
Vec<PactSource>
filter
&FilterInfo
consumers
&Vec<String>
options
&VerificationOptions
runtime
&mut Runtime
provider_info
&ProviderInfo
source
Vec<PactSource>
filter
&FilterInfo
consumers
&Vec<String>
options
&VerificationOptions
runtime
&mut Runtime