//   private IResourceManager resourceManager;
 //   private IResourceLocatorManager locatorManager;
 //
 //   private URL testFileURL;
 //
 //   @Before
 //   public void setup() {
 //      resourceManager = new ResourceManager();
 //      locatorManager = new ResourceLocatorManager();
 //      testFileURL =
 //
 // getClass().getClassLoader().getResource("org/eclipse/osee/framework/resource/management/test/TestFile.txt");
 //   }
 @Test
 public void testAddRemoveProvider() {
   ResourceManager resourceManagerX = new ResourceManager();
   IResourceProvider provider1 = new ResourceProviderAdaptor();
   Assert.assertTrue(resourceManagerX.addResourceProvider(provider1));
   Assert.assertFalse(resourceManagerX.addResourceProvider(provider1)); // Add again
   Assert.assertTrue(resourceManagerX.removeResourceProvider(provider1));
 }
 @Test
 public void testAddRemoveListener() {
   ResourceManager resourceManagerX = new ResourceManager();
   IResourceListener listener = new MockResourceListener();
   Assert.assertTrue(resourceManagerX.addResourceListener(listener));
   Assert.assertFalse(resourceManagerX.addResourceListener(listener)); // Add again
   Assert.assertTrue(resourceManagerX.removeResourceListener(listener));
   Assert.assertFalse(resourceManagerX.removeResourceListener(listener)); // Add again
 }
  @Before
  public void setup() {
    provider1 = new MockLocatorProvider("protocol1");
    provider2 = new MockLocatorProvider("protocol2");
    provider3 = new MockLocatorProvider("protocol3");

    manager = new ResourceManager();
    manager.addResourceLocatorProvider(provider1);
    manager.addResourceLocatorProvider(provider2);
    manager.addResourceLocatorProvider(provider3);
  }
  @Test
  public void testGenerateLocator() throws OseeCoreException {
    // Test Protocol not found
    try {
      manager.generateResourceLocator("dummyProcotol", "", "");
      Assert.fail("This line should not be executed");
    } catch (OseeCoreException ex) {
      Assert.assertTrue(ex instanceof MalformedLocatorException);
    }

    IResourceLocator locator = manager.generateResourceLocator("protocol1", "ABCDE", "name1");
    Assert.assertTrue(locator instanceof MockResourceLocator);
    MockResourceLocator mockLocator = (MockResourceLocator) locator;
    Assert.assertEquals("ABCDE", mockLocator.getSeed());
    Assert.assertEquals("name1", mockLocator.getName());
    Assert.assertNull(mockLocator.getRawPath());
  }
  @Test
  public void testEmptyProvider() {
    ResourceManager manager = new ResourceManager();
    Assert.assertEquals(0, manager.getProtocols().size());

    try {
      manager.getResourceLocator("protocol");
      Assert.fail("This line should not be executed");
    } catch (OseeCoreException ex) {
      Assert.assertTrue(ex instanceof OseeStateException);
    }
    try {
      manager.generateResourceLocator(null, null, null);
    } catch (OseeCoreException ex) {
      Assert.assertTrue(ex instanceof OseeStateException);
    }
  }
  @Test
  public void testGetProtocols() {
    List<String> actual = new ArrayList<String>(manager.getProtocols());
    Assert.assertEquals(3, actual.size());

    Collections.sort(actual);
    int index = 0;
    Assert.assertEquals("protocol1", actual.get(index++));
    Assert.assertEquals("protocol2", actual.get(index++));
    Assert.assertEquals("protocol3", actual.get(index++));
  }
  @Test
  public void testGetLocator() throws OseeCoreException {
    // Test Protocol not found
    try {
      manager.getResourceLocator("dummyProcotol://hello");
      Assert.fail("This line should not be executed");
    } catch (OseeCoreException ex) {
      Assert.assertTrue(ex instanceof MalformedLocatorException);
    }

    IResourceLocator locator = manager.getResourceLocator("protocol1://one/two/three");
    Assert.assertEquals("protocol1", locator.getProtocol());
    Assert.assertEquals("protocol1://one/two/three", locator.getRawPath());

    locator = manager.getResourceLocator("protocol2://1");
    Assert.assertEquals("protocol2", locator.getProtocol());
    Assert.assertEquals("protocol2://1", locator.getRawPath());

    locator = manager.getResourceLocator("protocol3");
    Assert.assertEquals("protocol3", locator.getProtocol());
  }
  @Test
  public void testAddAndRemove() {
    ResourceManager testManager = new ResourceManager();

    Assert.assertTrue(testManager.addResourceLocatorProvider(provider1));
    Assert.assertTrue(testManager.addResourceLocatorProvider(provider2));

    Assert.assertEquals(2, testManager.getProtocols().size());

    Assert.assertFalse(testManager.addResourceLocatorProvider(provider2)); // Add the same one again
    Assert.assertEquals(2, testManager.getProtocols().size());

    Assert.assertTrue(testManager.removeResourceLocatorProvider(provider1));
    Assert.assertEquals(1, testManager.getProtocols().size());

    Assert.assertFalse(
        testManager.removeResourceLocatorProvider(provider1)); // Remove the same one again
    Assert.assertEquals(1, testManager.getProtocols().size());

    Assert.assertTrue(testManager.removeResourceLocatorProvider(provider2));
    Assert.assertEquals(0, testManager.getProtocols().size());
  }