3180: Move unit test to qa-functional test and adding Case creation and deletion

This commit is contained in:
U-BASIS\zhaohui 2017-11-07 13:45:21 -05:00
parent 2bc4a03f0a
commit a8648cdbb1
5 changed files with 116 additions and 56 deletions

View File

@ -244,6 +244,46 @@
<code-name-base>org.netbeans.libs.junit4</code-name-base>
<compile-dependency/>
</test-dependency>
<test-dependency>
<code-name-base>org.netbeans.modules.jellytools.java</code-name-base>
<compile-dependency/>
</test-dependency>
<test-dependency>
<code-name-base>org.netbeans.modules.jellytools.platform</code-name-base>
<compile-dependency/>
</test-dependency>
<test-dependency>
<code-name-base>org.netbeans.modules.jemmy</code-name-base>
<compile-dependency/>
</test-dependency>
<test-dependency>
<code-name-base>org.netbeans.modules.nbjunit</code-name-base>
<compile-dependency/>
</test-dependency>
</test-type>
<test-type>
<name>qa-functional</name>
<test-dependency>
<code-name-base>org.netbeans.libs.junit4</code-name-base>
<compile-dependency/>
</test-dependency>
<test-dependency>
<code-name-base>org.netbeans.modules.jellytools.java</code-name-base>
<compile-dependency/>
</test-dependency>
<test-dependency>
<code-name-base>org.netbeans.modules.jellytools.platform</code-name-base>
<compile-dependency/>
</test-dependency>
<test-dependency>
<code-name-base>org.netbeans.modules.jemmy</code-name-base>
<compile-dependency/>
</test-dependency>
<test-dependency>
<code-name-base>org.netbeans.modules.nbjunit</code-name-base>
<recursive/>
<compile-dependency/>
</test-dependency>
</test-type>
</test-dependencies>
<public-packages>

View File

@ -0,0 +1,73 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011-2017 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.ingest;
import static junit.framework.Assert.assertTrue;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import junit.framework.TestCase;
import org.netbeans.junit.NbModuleSuite;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.CaseActionException;
import org.sleuthkit.autopsy.casemodule.CaseDetails;
import junit.framework.Test;
import org.apache.commons.io.FileUtils;
import org.openide.util.Exceptions;
public class IngestFileFiltersTest extends TestCase {
private static final Path caseDirectoryPath = Paths.get(System.getProperty("java.io.tmpdir"), "IngestFileFiltersTest");
private static final File CASE_DIR = new File(caseDirectoryPath.toString());
public static Test suite() {
NbModuleSuite.Configuration conf = NbModuleSuite.createConfiguration(IngestFileFiltersTest.class).
clusters(".*").
enableModules(".*");
return conf.suite();
}
@Override
public void setUp() {
try {
Case.createAsCurrentCase(Case.CaseType.SINGLE_USER_CASE, caseDirectoryPath.toString(), new CaseDetails("IngestFiltersTest"));
} catch (CaseActionException ex) {
Exceptions.printStackTrace(ex);
}
assertTrue(CASE_DIR.exists());
}
@Override
public void tearDown() {
try {
Case.closeCurrentCase();
FileUtils.deleteDirectory(CASE_DIR);
} catch (CaseActionException | IOException ex) {
Exceptions.printStackTrace(ex);
}
assertFalse(CASE_DIR.exists());
}
public void testFilter() {
System.out.println("testFilter");
}
}

View File

@ -31,7 +31,7 @@ import org.sleuthkit.datamodel.Content;
* thread.
*/
@Immutable
public class UnitTestDspCallback extends DataSourceProcessorCallback {
public class FunctionalTestDspCallback extends DataSourceProcessorCallback {
private final Object monitor;
private final List<String> errorMessages = new ArrayList<>();
@ -46,7 +46,7 @@ public class UnitTestDspCallback extends DataSourceProcessorCallback {
* @param monitor A monitor for the callback to signal when the data source
* processor completes its processing.
*/
UnitTestDspCallback(Object monitor) {
FunctionalTestDspCallback(Object monitor) {
this.monitor = monitor;
}

View File

@ -25,7 +25,7 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorProgress
* A data source processor progress monitor for unit testing.
*/
@Immutable
public class UnitTestDspProgressMonitor implements DataSourceProcessorProgressMonitor {
public class FunctionalTestDspProgressMonitor implements DataSourceProcessorProgressMonitor {
/**
* Switches the progress indicator to indeterminate mode (the total number

View File

@ -1,53 +0,0 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011-2017 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/package org.sleuthkit.autopsy.ingest;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openide.modules.Places;
public class IngestFileFiltersTest {
public IngestFileFiltersTest() {
}
@BeforeClass
public static void setUpClass() {
}
@AfterClass
public static void tearDownClass() {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
@Test
public void testFilters() {
Places.getUserDirectory().getAbsoluteFile();
System.out.println("Test filter");
}
}