コード例 #1
0
  @Test
  public void testValid4Context() throws Exception {
    // for context
    ImportRepTypeHandler basicHandler = new ImportRepTypeHandler();

    Map<String, String> data = new HashMap<String, String>();
    data.put("type", ERepositoryObjectType.CONTEXT.getType());
    basicHandler.setInitializationData(null, null, data);

    ResourcesManager resManager = mock(ResourcesManager.class);
    Set<IPath> pathes = new HashSet<IPath>(initPathes);
    when(resManager.getPaths()).thenReturn(pathes);

    Assert.assertFalse(basicHandler.valid(resManager, processPropPath1));
    Assert.assertFalse(basicHandler.valid(resManager, processItemPath1));
    Assert.assertFalse(basicHandler.valid(resManager, processItemPath2));
    Assert.assertFalse(basicHandler.valid(resManager, processItemPath3));
    Assert.assertFalse(basicHandler.valid(resManager, connPropPath));
    Assert.assertFalse(basicHandler.valid(resManager, connItemPath));

    IPath contextPropPath = new Path("TEST/context/test_0.1.properties");
    IPath contextItemPath = new Path("TEST/context/test_0.1.item");
    pathes.add(contextPropPath);
    pathes.add(contextItemPath);
    Assert.assertTrue(basicHandler.valid(resManager, contextPropPath));
    Assert.assertFalse(basicHandler.valid(resManager, contextItemPath));
  }
コード例 #2
0
  @Test
  public void testValid4Unknown() throws Exception {
    ImportRepTypeHandler basicHandler = new ImportRepTypeHandler();

    Map<String, String> data = new HashMap<String, String>();
    data.put("type", "XXX");
    basicHandler.setInitializationData(null, null, data);

    ResourcesManager resManager = mock(ResourcesManager.class);
    Set<IPath> pathes = new HashSet<IPath>(initPathes);
    when(resManager.getPaths()).thenReturn(pathes);

    Assert.assertFalse(basicHandler.valid(resManager, processPropPath1));
    Assert.assertFalse(basicHandler.valid(resManager, processItemPath1));
    Assert.assertFalse(basicHandler.valid(resManager, processItemPath2));
    Assert.assertFalse(basicHandler.valid(resManager, processItemPath3));
    Assert.assertFalse(basicHandler.valid(resManager, connPropPath));
    Assert.assertFalse(basicHandler.valid(resManager, connItemPath));
  }
コード例 #3
0
  @Test
  public void testValid4Connection() throws Exception {
    // DB connections
    ImportRepTypeHandler basicHandler = new ImportRepTypeHandler();

    Map<String, String> data = new HashMap<String, String>();
    data.put(
        "type",
        ERepositoryObjectType.PROCESS.getType()
            + ","
            + ERepositoryObjectType.METADATA_CONNECTIONS.getType());
    basicHandler.setInitializationData(null, null, data);

    ResourcesManager resManager = mock(ResourcesManager.class);
    Set<IPath> pathes = new HashSet<IPath>(initPathes);
    when(resManager.getPaths()).thenReturn(pathes);

    Assert.assertTrue(basicHandler.valid(resManager, processPropPath1));
    Assert.assertFalse(basicHandler.valid(resManager, processItemPath1));
    Assert.assertTrue(basicHandler.valid(resManager, processItemPath2));
    Assert.assertFalse(basicHandler.valid(resManager, processItemPath3));
    Assert.assertTrue(basicHandler.valid(resManager, connPropPath));
    Assert.assertFalse(basicHandler.valid(resManager, connItemPath));
  }