<commit_before>/*
 * Package : dartivity
 * Author : <NAME> <<EMAIL>>
 * Date   : 28/09/2015
 * Copyright :  S.Hamblett 2015
 */

library dartivity.test;

import 'dart:async';
import 'dart:io';

import 'package:dartivity/dartivity.dart';

Future main() async {
  final int badExitCode = -1;

  // Instantiate a Dartivity client and initialise for
  // Iotivity only
  Dartivity dartivity = new Dartivity(Mode.iotOnly);

  // Initialise
  DartivityIotivityCfg iotCfg = new DartivityIotivityCfg(
      qos: DartivityIotivityCfg.QualityOfService_LowQos);

  await dartivity.initialise("", "", iotCfg);

  if (dartivity.initialised) {
    print("Initialse Status is true - OK");
  } else {
    print("Oops Initialse Status is false - ERROR");
    exit(badExitCode);
  }

  // Find a resource

  // None found
  String requestUri = "/oic/res";
  DartivityIotivityResource foundResource =
  await dartivity.findResource("", requestUri);
  if (foundResource != null) {
    print(foundResource.toString());
  } else {
    print("Dartivity - Dartivity Test Harness >> - No resource found");
  }


}<commit_msg>Resource class and platform find resource, testing<commit_after>/*
 * Package : dartivity
 * Author : <NAME> <<EMAIL>>
 * Date   : 28/09/2015
 * Copyright :  S.Hamblett 2015
 */

library dartivity.test;

import 'dart:async';
import 'dart:io';

import 'package:dartivity/dartivity.dart';

Future main() async {
  final int badExitCode = -1;

  // Instantiate a Dartivity client and initialise for
  // Iotivity only
  Dartivity dartivity = new Dartivity(Mode.iotOnly);

  // Initialise
  DartivityIotivityCfg iotCfg = new DartivityIotivityCfg(
      qos: DartivityIotivityCfg.QualityOfService_LowQos);

  await dartivity.initialise("", "", iotCfg);

  if (dartivity.initialised) {
    print("Initialse Status is true - OK");
  } else {
    print("Oops Initialse Status is false - ERROR");
    exit(badExitCode);
  }

  // At this point we need an iotivity server, see thhe simpleserver in
  // resource/examples from the iotivity code and start it.

  // Find a resource

  // None found
  String requestUri = "/oic11/res";
  DartivityIotivityResource foundResource =
  await dartivity.findResource("", requestUri);
  if (foundResource != null) {
    print(foundResource.toString());
  } else {
    print("Dartivity - Dartivity Test Harness >> - No resource found");
  }

  // Should find one
  requestUri = "/oic/res";
  foundResource = await dartivity.findResource("", requestUri);
  if (foundResource != null) {
    print(foundResource.toString());
  } else {
    print("Dartivity - Dartivity Test Harness >> - No resource found");
  }
}
{'fraction_non_alphanumeric': 0.1215909090909091, 'fraction_numerical': 0.010606060606060607, 'mean_word_length': 3.6090750436300176, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2867118', 'n_tokens_mistral': 906, 'n_tokens_neox': 842, 'n_words': 225}