Autopsy  4.20.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
TestAutopsyService.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011-2017 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.test;
20 
21 import java.util.logging.Level;
22 import org.openide.util.lookup.ServiceProvider;
26 
30 //@ServiceProvider(service = AutopsyService.class)
31 public class TestAutopsyService implements AutopsyService {
32 
33  private static final Logger logger = Logger.getLogger(TestAutopsyService.class.getName());
34 
35  @Override
36  public String getServiceName() {
37  return "Test Autopsy Service";
38  }
39 
40  @Override
42  ProgressIndicator progressIndicator = context.getProgressIndicator();
43  try {
44  progressIndicator.start("Test Autopsy Service doing first task...");
45  logger.log(Level.INFO, "Test Autopsy Service simulating work on first task");
46  Thread.sleep(1000L);
47  progressIndicator.progress(20);
48  Thread.sleep(1000L);
49  progressIndicator.progress(40);
50  Thread.sleep(1000L);
51  progressIndicator.progress(60);
52  Thread.sleep(1000L);
53  progressIndicator.progress(80);
54  Thread.sleep(1000L);
55  progressIndicator.progress(100);
56  progressIndicator.finish();
57  progressIndicator.start("Test Autopsy Service doing second task...");
58  for (int i = 0; i < 10000; ++i) {
59  logger.log(Level.INFO, "Test Autopsy Service simulating work on second task");
60  if (context.cancelRequested()) {
61  logger.log(Level.INFO, "Test Autopsy Service cancelled while doing second task, cancel requested = {0}", context.cancelRequested());
62  break;
63  }
64  }
65  progressIndicator.finish();
66  } catch (InterruptedException ex) {
67  logger.log(Level.INFO, "Test Autopsy Service interrupted (cancelled) while doing first task, cancel requested = {0}", context.cancelRequested());
68  }
69  }
70 
71 }
void start(String message, int totalWorkUnits)
synchronized static Logger getLogger(String name)
Definition: Logger.java:124

Copyright © 2012-2022 Basis Technology. Generated on: Tue Aug 1 2023
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.