Back to index

nordugrid-arc-nox  1.1.0~rc6
Public Member Functions | Private Member Functions
InfoFilterTest Class Reference

List of all members.

Public Member Functions

void setUp ()
void tearDown ()
void TestInfoFilter ()

Private Member Functions

 CPPUNIT_TEST_SUITE (InfoFilterTest)
 CPPUNIT_TEST (TestInfoFilter)
 CPPUNIT_TEST_SUITE_END ()

Detailed Description

Definition at line 19 of file InfoFilterTest.cpp.


Member Function Documentation

Definition at line 49 of file InfoFilterTest.cpp.

                           {
  std::string paths;
  std::string toppath = Glib::get_current_dir();
  // Find top source directory by looking for configure file
  for(int n=0;n<15;++n) {
    std::string fname = Glib::build_filename(toppath, "configure");
    if(file_test(fname, Glib::FILE_TEST_IS_REGULAR)) {
      // Go to all .libs directories
      add_libs(paths,toppath);
      break;
    };
    toppath = Glib::path_get_dirname(toppath);
  };
  Arc::SetEnv("ARC_PLUGIN_PATH",paths);
}

Here is the call graph for this function:

Definition at line 66 of file InfoFilterTest.cpp.

                              {
}

Definition at line 105 of file InfoFilterTest.cpp.

                                    {

  // Service description document
  Arc::XMLNode infodoc("\
<?xml version=\"1.0\"?>\n\
<InfoDoc xmlns=\"urn:info\">\n\
  <Resource>\n\
    <Memory>A lot</Memory>\n\
    <Performance>Turltle-like</Performance>\n\
  </Resource>\n\
  <Owner>\n\
      <Name>Unknown</Name>\n\
  </Owner>\n\
  <Resource>\n\
      <Memory>640kb enough for everyone</Memory>\n\
      <Performance>Quantum computer</Performance>\n\
  </Resource>\n\
</InfoDoc>\n");

  // Policies
  Arc::XMLNode policy1("\
<?xml version=\"1.0\"?>\n\
<InfoFilterDefinition xmlns=\"http://www.nordugrid.org/schemas/InfoFilter/2008\" id=\"policy1\">\n\
  <Policy xmlns=\"http://www.nordugrid.org/schemas/policy-arc\" PolicyId=\"policy1\" CombiningAlg=\"Deny-Overrides\">\n\
    <Rule RuleId=\"rule1\" Effect=\"Permit\">\n\
      <Subjects>\n\
        <Subject Type=\"string\" AttributeId=\"urn:testID\">USER1</Subject>\n\
      </Subjects>\n\
    </Rule>\n\
  </Policy>\n\
</InfoFilterDefinition>");

  Arc::XMLNode policy2("\
<?xml version=\"1.0\"?>\n\
<InfoFilterDefinition xmlns=\"http://www.nordugrid.org/schemas/InfoFilter/2008\" id=\"policy2\">\n\
  <Policy xmlns=\"http://www.nordugrid.org/schemas/policy-arc\" PolicyId=\"policy1\" CombiningAlg=\"Deny-Overrides\">\n\
    <Rule RuleId=\"rule1\" Effect=\"Permit\">\n\
      <Subjects>\n\
        <Subject Type=\"string\" AttributeId=\"urn:testID\">USER2</Subject>\n\
      </Subjects>\n\
    </Rule>\n\
  </Policy>\n\
</InfoFilterDefinition>");

  // Service description with policies
  XMLNode infodoc_sec;
  infodoc.New(infodoc_sec);
  infodoc_sec["Resource"][0].NewChild(policy1);
  infodoc_sec["Resource"][0].NewAttribute("InfoFilterTag")="policy1";
  infodoc_sec["Resource"][1].NewChild(policy2);
  infodoc_sec["Resource"][1].NewAttribute("InfoFilterTag")="policy2";

  // Requestor's identifier
  MessageAuth user_id;
  TestSecAttr* user_attr = new TestSecAttr("USER1");
  user_id.set("TEST",user_attr);

  // Filter
  InfoFilter filter(user_id);

  // External policies
  //Arc::NS ns;
  //XMLNode policy1();
  std::list< std::pair<std::string,XMLNode> > policies;

  // Service description for filtering
  XMLNode infodoc_filtered;

  // Applying filter
  infodoc_sec.New(infodoc_filtered);
  CPPUNIT_ASSERT(filter.Filter(infodoc_filtered));

}

Here is the call graph for this function:


The documentation for this class was generated from the following file: