Exemplo n.º 1
0
 @Test
 public void testTemplate() {
   MassImportForm massImportForm = new MassImportForm();
   assertNotNull(massImportForm);
   massImportForm.setTemplate(template);
   assertEquals(template, massImportForm.getTemplate());
 }
Exemplo n.º 2
0
 @Test
 public void testGetCurrentPlugin() {
   MassImportForm massImportForm = new MassImportForm();
   assertNotNull(massImportForm);
   massImportForm.setTemplate(template);
   massImportForm.setCurrentPlugin("JunitImportPlugin");
   assertEquals("JunitImportPlugin", massImportForm.getCurrentPlugin());
 }
Exemplo n.º 3
0
 @Test
 public void testFormat() {
   MassImportForm massImportForm = new MassImportForm();
   assertNotNull(massImportForm);
   assertEquals("", massImportForm.getFormat());
   massImportForm.setFormat("marcxml");
   assertEquals(ImportFormat.MARCXML.getTitle(), massImportForm.getFormat());
 }
Exemplo n.º 4
0
 @Test
 public void testRecords() {
   MassImportForm massImportForm = new MassImportForm();
   assertNotNull(massImportForm);
   String fixture = "test";
   massImportForm.setRecords(fixture);
   assertEquals("test", massImportForm.getRecords());
 }
Exemplo n.º 5
0
 @Test
 public void testGetDocstructssize() {
   MassImportForm massImportForm = new MassImportForm();
   assertNotNull(massImportForm);
   massImportForm.setTemplate(template);
   massImportForm.setCurrentPlugin("JunitImportPluginWithSecondPage");
   assertEquals(1, massImportForm.getDocstructssize());
 }
Exemplo n.º 6
0
 @Test
 public void testGetFormats() {
   MassImportForm massImportForm = new MassImportForm();
   assertNotNull(massImportForm);
   List<String> fixture = massImportForm.getFormats();
   assertNotNull(fixture);
   assertNotEquals(0, fixture.size());
 }
Exemplo n.º 7
0
 @Test
 public void testIds() {
   MassImportForm massImportForm = new MassImportForm();
   assertNotNull(massImportForm);
   List<String> fixture = new ArrayList<>();
   fixture.add("ID");
   massImportForm.setIds(fixture);
   assertEquals(fixture, massImportForm.getIds());
 }
Exemplo n.º 8
0
 @Test
 public void testPossibleDigitalCollections() {
   MassImportForm massImportForm = new MassImportForm();
   assertNotNull(massImportForm);
   List<String> fixture = new ArrayList<>();
   fixture.add("collection");
   massImportForm.setPossibleDigitalCollection(fixture);
   assertEquals(fixture, massImportForm.getPossibleDigitalCollection());
 }
Exemplo n.º 9
0
 @SuppressWarnings("deprecation")
 @Test
 public void testCurrentFormat() {
   MassImportForm massImportForm = new MassImportForm();
   assertNotNull(massImportForm);
   assertEquals("", massImportForm.getCurrentFormat());
   massImportForm.setCurrentFormat("marcxml");
   assertEquals(ImportFormat.MARCXML.getTitle(), massImportForm.getCurrentFormat());
 }
Exemplo n.º 10
0
 @Test
 public void testSelectedFilenames() {
   MassImportForm massImportForm = new MassImportForm();
   assertNotNull(massImportForm);
   List<String> filenames = new ArrayList<>();
   filenames.add("test");
   massImportForm.setSelectedFilenames(filenames);
   assertSame(filenames, massImportForm.getSelectedFilenames());
 }
Exemplo n.º 11
0
 @Test
 public void testGetUsablePluginsForRecords() {
   MassImportForm massImportForm = new MassImportForm();
   assertNotNull(massImportForm);
   List<String> plugins = new ArrayList<>();
   plugins.add("test");
   massImportForm.setUsablePluginsForRecords(plugins);
   assertSame(plugins, massImportForm.getUsablePluginsForRecords());
 }
Exemplo n.º 12
0
 @SuppressWarnings("deprecation")
 @Test
 public void testGetInclude() {
   MassImportForm massImportForm = new MassImportForm();
   assertNotNull(massImportForm);
   massImportForm.setTemplate(template);
   massImportForm.setCurrentPlugin("JunitImportPlugin");
   assertEquals("plugins/JunitImportPlugin.jsp", massImportForm.getInclude());
 }
Exemplo n.º 13
0
 @Test
 public void testPrepare() throws Exception {
   MassImportForm massImportForm = new MassImportForm();
   assertNotNull(massImportForm);
   massImportForm.setTemplate(template);
   assertEquals("", massImportForm.Prepare());
   secondStep.setBenutzer(userList);
   assertEquals("process_import_1", massImportForm.Prepare());
 }
Exemplo n.º 14
0
 @Test
 public void testGetProperties() {
   MassImportForm massImportForm = new MassImportForm();
   assertNotNull(massImportForm);
   massImportForm.setTemplate(template);
   massImportForm.setCurrentPlugin("JunitImportPluginWithProperties");
   List<ImportProperty> fixture = massImportForm.getProperties();
   assertEquals(1, fixture.size());
 }
Exemplo n.º 15
0
  @Test
  public void testUploadedFile() throws FileNotFoundException {
    InputStream stream = new FileInputStream("/opt/digiverso/junit/data/metadata.xml");
    Part file = new MockUploadedFile(stream, "junit");
    MassImportForm massImportForm = new MassImportForm();
    assertNotNull(massImportForm);
    massImportForm.setTemplate(template);

    massImportForm.setUploadedFile(file);
    assertEquals(file, massImportForm.getUploadedFile());
  }
Exemplo n.º 16
0
  @Test
  public void testProcessList() {
    MassImportForm massImportForm = new MassImportForm();
    assertNotNull(massImportForm);
    massImportForm.setTemplate(template);

    List<Process> processList = new ArrayList<>();
    processList.add(template);
    massImportForm.setProcessList(processList);
    assertEquals(processList, massImportForm.getProcessList());
  }
Exemplo n.º 17
0
  @Test
  public void testConvertWithFileRecord() throws FileNotFoundException {

    MassImportForm massImportForm = new MassImportForm();
    assertNotNull(massImportForm);
    massImportForm.setTemplate(template);
    massImportForm.setRecords("junit");

    massImportForm.setCurrentPlugin("JunitImportPlugin");
    String fixture = massImportForm.convertData();
    assertEquals("process_import_3", fixture);
  }
Exemplo n.º 18
0
 @SuppressWarnings("deprecation")
 @Test
 public void testProcess() {
   MassImportForm massImportForm = new MassImportForm();
   assertNotNull(massImportForm);
   List<Process> fixture = new ArrayList<>();
   fixture.add(template);
   massImportForm.setProcess(fixture);
   assertEquals(fixture, massImportForm.getProcess());
   massImportForm.setProcesses(fixture);
   assertEquals(fixture, massImportForm.getProcess());
 }
Exemplo n.º 19
0
  @Test
  public void testConvertFail() throws FileNotFoundException {

    MassImportForm massImportForm = new MassImportForm();
    assertNotNull(massImportForm);
    massImportForm.setTemplate(template);
    List<String> list = new ArrayList<>();
    list.add("junit");
    massImportForm.setSelectedFilenames(list);

    massImportForm.setCurrentPlugin("JunitImportPluginError");
    String fixture = massImportForm.convertData();
    assertEquals("", fixture);
  }
Exemplo n.º 20
0
  @Test
  public void testUploadFile() throws FileNotFoundException {
    InputStream stream = new FileInputStream("/opt/digiverso/junit/data/metadata.xml");
    Part file = new MockUploadedFile(stream, "./some/path\\junit.xml");
    MassImportForm massImportForm = new MassImportForm();
    assertNotNull(massImportForm);
    massImportForm.setTemplate(template);

    massImportForm.setUploadedFile(file);
    massImportForm.uploadFile();

    Path dest = Paths.get(ConfigurationHelper.getInstance().getTemporaryFolder(), "junit.xml");
    assertTrue(Files.exists(dest) && Files.isRegularFile(dest));
  }
Exemplo n.º 21
0
  @Test
  public void testGetNextPage() {
    MassImportForm massImportForm = new MassImportForm();
    assertNotNull(massImportForm);
    massImportForm.setTemplate(template);
    massImportForm.setCurrentPlugin("JunitImportPlugin");
    String fixture = massImportForm.nextPage();
    assertEquals("", fixture);

    massImportForm.setIdList("junit");
    fixture = massImportForm.nextPage();
    assertEquals("process_import_2", fixture);

    massImportForm.setCurrentPlugin("JunitImportPluginWithSecondPage");
    fixture = massImportForm.nextPage();
    assertEquals("process_import_2_mass", fixture);
  }
Exemplo n.º 22
0
  @Test
  public void testGetHasNextPage() {
    MassImportForm massImportForm = new MassImportForm();
    assertNotNull(massImportForm);
    massImportForm.setTemplate(template);
    massImportForm.setCurrentPlugin("JunitImportPlugin");
    boolean fixture = massImportForm.getHasNextPage();
    assertFalse(fixture);

    massImportForm.setCurrentPlugin("JunitImportPluginWithSecondPage");
    fixture = massImportForm.getHasNextPage();
    assertTrue(fixture);

    massImportForm.setCurrentPlugin("JunitImportPluginWithProperties");
    fixture = massImportForm.getHasNextPage();
    assertTrue(fixture);
  }
Exemplo n.º 23
0
 @Test
 public void testConvertWithFileUpload() throws FileNotFoundException {
   InputStream stream = new FileInputStream("/opt/digiverso/junit/data/metadata.xml");
   Part file = new MockUploadedFile(stream, "./some/path\\junit.xml");
   MassImportForm massImportForm = new MassImportForm();
   assertNotNull(massImportForm);
   massImportForm.setTemplate(template);
   massImportForm.setUploadedFile(file);
   massImportForm.uploadFile();
   massImportForm.setCurrentPlugin("JunitImportPlugin");
   String fixture = massImportForm.convertData();
   assertEquals("process_import_3", fixture);
 }
Exemplo n.º 24
0
  @Test
  public void testGetDocstructs() {
    MassImportForm massImportForm = new MassImportForm();
    assertNotNull(massImportForm);
    massImportForm.setTemplate(template);
    massImportForm.setCurrentPlugin("JunitImportPlugin");
    List<? extends DocstructElement> fixture = massImportForm.getDocstructs();
    assertEquals(0, fixture.size());

    massImportForm.setCurrentPlugin("JunitImportPluginWithSecondPage");
    fixture = massImportForm.getDocstructs();
    assertEquals(1, fixture.size());
  }