From: Maria Guseva Date: Wed, 5 Oct 2016 16:10:21 +0000 (+0300) Subject: [RELEASE] DA 2.3.17 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9f55d6bf2952d09b41fb98a67d686a4f55af874b;p=sdk%2Ftools%2Fdynamic-analyzer.git [RELEASE] DA 2.3.17 - Memory Map table now shows maps for different processes separately - Implement filter popup menu for Persistent Allocations table - Update screenshot feature selection in CLI - Update according to common-eplugin SdbHelper API changes - Fix About dialog according to GUI guide - Fix port accuring for CLI communication process - Fix application selection combobox to be up to date - Fix the list of selected features not updated on target change (regression in DA 2.3.16) - Fix Persistent Memory charts for main executable (regression in DA 2.3.16) - Fix Persistent Memory charts to be updated immediately on switch on/off (regression in DA 2.3.16) - Fix 13 FindBugs warnings - Modify architecture of CallTraceView class - Replace pixel top offsets in SearchDialog with ratio offsets - Refactor SettingDataManager class - Fix JIRA defects: SPTSDKUX-1909: Startup info not shown when selecting UIHV features SPTSDKUX-2159: In Dynamic analyzer while typing any text in remote device window, GUI gets disturbed. Change-Id: Id21e7d71c44b84bb751c69c45d1c08afb9704d96 --- diff --git a/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/resources/FontResources.java b/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/resources/FontResources.java index 7006116..9e04799 100644 --- a/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/resources/FontResources.java +++ b/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/resources/FontResources.java @@ -252,13 +252,13 @@ public class FontResources { "dialog_contents_normal_font", resizeDefaultFont(8, 3));//$NON-NLS-1$ public static final Font ABOUT_DIALOG_TITLE_BIG_FONT = getFont( - "about_dialog_title_big_font", new FontData[] { new FontData("Arial", 20, SWT.BOLD) });//$NON-NLS-1$ + "about_dialog_title_big_font", new FontData[] { new FontData("BreezeS", 23, SWT.BOLD) });//$NON-NLS-1$ public static final Font ABOUT_DIALOG_TITLE_BIG_FONT_MAC = getFont( "about_dialog_title_big_font_mac", new FontData[] { new FontData("BreezeS", 23, SWT.BOLD) });//$NON-NLS-1$ public static final Font ABOUT_DIALOG_TITLE_MIDDLE_FONT = getFont( - "about_dialog_title_middle_font", new FontData[] { new FontData("Arial", 10, SWT.NORMAL) });//$NON-NLS-1$ + "about_dialog_title_middle_font", new FontData[] { new FontData("BreezeS", 12, SWT.NORMAL) });//$NON-NLS-1$ public static final Font ABOUT_DIALOG_TITLE_MIDDLE_FONT_MAC = getFont( "about_dialog_title_middle_font_mac", new FontData[] { new FontData("BreezeS", 13, SWT.NORMAL) });//$NON-NLS-1$ diff --git a/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/widgets/da/base/DATextBox.java b/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/widgets/da/base/DATextBox.java index 4f8011b..1bf46a5 100644 --- a/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/widgets/da/base/DATextBox.java +++ b/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/widgets/da/base/DATextBox.java @@ -31,7 +31,7 @@ import org.eclipse.swt.events.FocusEvent; import org.eclipse.swt.events.FocusListener; import org.eclipse.swt.events.PaintEvent; import org.eclipse.swt.events.PaintListener; -import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.graphics.Point; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Text; import org.tizen.dynamicanalyzer.resources.ColorResources; @@ -46,9 +46,8 @@ public class DATextBox extends DAAbstractText{ public void paintControl(PaintEvent e) { e.gc.setForeground(boaderColor); Text text = (Text) e.widget; - Rectangle rect = text.getClientArea(); - e.gc.drawRectangle(rect.x, rect.y, rect.width - 1, - rect.height - 1); + Point size = text.getSize(); + e.gc.drawRectangle(0, 0, size.x - 1, size.y - 1); } }); diff --git a/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/CliInternals.java b/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/CliInternals.java index 823c671..5b233cc 100644 --- a/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/CliInternals.java +++ b/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/CliInternals.java @@ -65,7 +65,7 @@ public final class CliInternals { // Initialize SettingDataManager String selectedTarget = SettingDataManager.INSTANCE - .getConnectedTarget().getTargetName(); + .getConnectedTargetOrSelected().getTargetName(); SettingDataManager.INSTANCE.setSelectedTarget(selectedTarget); } @@ -279,7 +279,7 @@ public final class CliInternals { target.setSelectedFlatFeatures(new HashSet()); selectScreenshotFeature(args.getScreenshotPeriod(), - args.isScreenshotPeriodSpecified()); + args.getScreenshotOnSceneTransition()); args.getFeatures().remove(PrimitiveFeature.SCREENSHOT);//This feature added to target by selectScreenshotFeature(). for (PrimitiveFeature feature : args.getFeatures()) { @@ -293,27 +293,35 @@ public final class CliInternals { /** * Enables screenshot onSceneTransition or periodically. * - * @param period period in seconds, onSceneTransition if period == 0. - * @return was operation successful or not. + * @param period period in seconds + * @param onSceneTransition enable on scene transition or not */ private static void selectScreenshotFeature(int period, - boolean isScreenshotsEnabled) { + boolean onSceneTransition) { // TODO move this to common place for CLI and GUI - if (!isScreenshotsEnabled) { + if ((!onSceneTransition) && (period <= 0)) { Logger.debug("Screenshots are not captured."); return; } - if (period == 0){ - TargetData target = SettingDataManager.INSTANCE.getTarget(null); - target.addSelectedFlatFeature(ConfigureLabels.FEATURE_NAME_SCREENSHOT); + TargetData target = SettingDataManager.INSTANCE.getTarget(null); + target.addSelectedFlatFeature(ConfigureLabels.FEATURE_NAME_SCREENSHOT); + if (onSceneTransition) { + SettingDataManager.INSTANCE.addOptionsSelectedPreference( + FlatPreferences.SCREENSHOT_ON_SCENE_TRANSITION, 1); Logger.debug("Screenshots are captured on scene transition."); + } else { + SettingDataManager.INSTANCE + .deleteOptionsSelectedPreference(FlatPreferences.SCREENSHOT_ON_SCENE_TRANSITION); } if (period > 0){ SettingDataManager.INSTANCE.addOptionsSelectedPreference( FlatPreferences.SCREENSHOT_PERIODICALLY, period); Logger.debug("Screenshots are captured every " + period + " sec."); + } else { + SettingDataManager.INSTANCE + .deleteOptionsSelectedPreference(FlatPreferences.SCREENSHOT_PERIODICALLY); } UILayoutDataManager.INSTANCE .addSelectedChart(TimelineChartLabels.SCREENSHOT_CHART_TITLE); diff --git a/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/manager/ProcessManager.java b/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/manager/ProcessManager.java index 91a2f0c..2136f8d 100644 --- a/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/manager/ProcessManager.java +++ b/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/manager/ProcessManager.java @@ -25,10 +25,6 @@ public class ProcessManager implements ProcessManagerMBean { static int TRACING_PROCESS_STOP_TIMEOUT = 16000; // TODO measure this timeout more accurate later /** - * Value to start port enumeration - */ - public static final int DEFAULT_PORT = 9000; - /** * Map between device and last trace manager used for that device. */ Map mTracingMap; @@ -93,10 +89,9 @@ public class ProcessManager implements ProcessManagerMBean { return new DAResult(ErrorCode.ERR_BUSY_DEVICE); } - int port = DEFAULT_PORT + mTracingMap.size(); final TracingProcessManager tpManager; try { - tpManager = TracingProcessManager.createTracingProcess(args, port); + tpManager = TracingProcessManager.createTracingProcess(args); } catch (IOException e) { Logger.error("Couldn't start tracing proccess: %s.", e.toString()); return new DAResult(ErrorCode.ERR_EXCEPTION_OCCURRED, "Couldn't start tracing process: " + e.toString()); diff --git a/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/manager/TracingProcessManager.java b/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/manager/TracingProcessManager.java index b85978c..fe9d64b 100644 --- a/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/manager/TracingProcessManager.java +++ b/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/manager/TracingProcessManager.java @@ -51,11 +51,11 @@ public class TracingProcessManager { * Execute new tracing process with specified arguments and wrap it with {@link TracingProcessManager}. * * @param args tracing arguments - * @param port integer socket port number * @return {@link TracingProcessManager} instance that manages corresponding process. * @throws IOException in error occurred while executing process */ - public static TracingProcessManager createTracingProcess(TracingArguments args, int port) throws IOException { + public static TracingProcessManager createTracingProcess( + TracingArguments args) throws IOException { // compose command line String currentClasspath = System.getProperty("java.class.path"); @@ -91,14 +91,30 @@ public class TracingProcessManager { // send communication port number to tracing process bw = new BufferedWriter(new OutputStreamWriter( process.getOutputStream(), StandardCharsets.UTF_8)); + ServerSocket ss = getServerSocket(); try { - bw.write(Integer.toString(port)); + bw.write(Integer.toString(ss.getLocalPort())); bw.newLine(); bw.flush(); } catch (IOException e2) { } - return new TracingProcessManager(args, process, port); + return new TracingProcessManager(args, process, ss); + } + + /** + * Method allocates available local socket. + * + * @return ServerSocket instance with free port. + */ + private static ServerSocket getServerSocket() { + while (true) { + try { + ServerSocket ss = new ServerSocket(0); + return ss; + } catch (IOException e) { + } + } } /** @@ -152,20 +168,19 @@ public class TracingProcessManager { } /** - * Private constructor. - * Instances should be created via {@link #createTracingProcess(TracingArguments)}. + * Private constructor. Instances should be created via + * {@link #createTracingProcess(TracingArguments)}. * * @param args arguments with which tracing process started * @param process process instance corresponding to the tracing process - * @param port integer socket port number + * @param ss ServerSocket to start communication */ private TracingProcessManager(TracingArguments args, Process process, - int port) { + ServerSocket ss) { ctx = new TracingProcessContext(args); tracingProcess = process; try { - final ServerSocket ss = new ServerSocket(port); Socket socket = ss.accept(); ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream()); oos.flush(); diff --git a/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/tracing/TracingArguments.java b/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/tracing/TracingArguments.java index c0b95de..88af914 100644 --- a/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/tracing/TracingArguments.java +++ b/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/tracing/TracingArguments.java @@ -25,9 +25,8 @@ public class TracingArguments implements Cloneable, Serializable { private String output; // absolute path to file with tracing output // TODO duration actually is not supported yet by CLI, always set to 0 private long durationSec; // tracing duration in seconds (0 is for unlimited duration) - private int screenshotPeriod = 0; // Screenshot period in s. If 0 - // onSceneTransition else periodically - private boolean isScreenshotPeriodSpecified = false; + private int screenshotPeriod = 0; // Screenshot period in seconds + private boolean screenshotOnSceneTransition = false;// take screenshots on scene transition or not private String errMessage; // contains message about all found errors during validation ( isValid() ) @@ -77,11 +76,9 @@ public class TracingArguments implements Cloneable, Serializable { } // Screenshot period check - if (isScreenshotPeriodSpecified) { - if (screenshotPeriod < 0) { - result = false; - msg += " * Screenshot period is negative%n"; - } + if (screenshotPeriod < 0) { + result = false; + msg += " * Screenshot period is negative%n"; } // Features check @@ -181,24 +178,34 @@ public class TracingArguments implements Cloneable, Serializable { } /** - * @return true if screenshots enabled. - */ - public boolean isScreenshotPeriodSpecified() { - return isScreenshotPeriodSpecified; - } - - /** * @param period The period in seconds to set. 0 for onSceneTransition. * @return this object to allow chained methods execution */ public TracingArguments setScreenshotPeriod(int period) { this.screenshotPeriod = period; - this.isScreenshotPeriodSpecified = true; this.featuresSet.add(PrimitiveFeature.SCREENSHOT); return this; } /** + * @return true if screenshots on scene transition enabled. + */ + public boolean getScreenshotOnSceneTransition() { + return screenshotOnSceneTransition; + } + + /** + * @param flag enable On Scene Transition screenshot capturing or not + * @return this object to allow chained methods execution + */ + public TracingArguments setScreenshotOnSceneTransition(boolean flag) { + this.screenshotOnSceneTransition = flag; + if (flag) + this.featuresSet.add(PrimitiveFeature.SCREENSHOT); + return this; + } + + /** * @return the featuresList list of features selected for tracing */ public Set getFeatures() { diff --git a/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/tracing/TracingArgumentsParser.java b/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/tracing/TracingArgumentsParser.java index 70afe0c..df37075 100644 --- a/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/tracing/TracingArgumentsParser.java +++ b/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/tracing/TracingArgumentsParser.java @@ -39,10 +39,11 @@ public class TracingArgumentsParser { private static Option screenshotPeriod = Option.builder("S") .hasArg() - .optionalArg(true) - .longOpt("screenshot") - .argName("screenshot") - .desc("Enable screenshots capturing periodically or on scene transition if no argument set") + .argName("period") + .desc("Enable screenshots capturing periodically").build(); + + private static Option screenshotTransition = Option.builder("s") + .desc("Enable screenshots capturing on scene transition") .build(); private static Options opts = new Options(); @@ -57,6 +58,7 @@ public class TracingArgumentsParser { opts.addOption(featureOpt.getOption()); } opts.addOption(screenshotPeriod); + opts.addOption(screenshotTransition); } /** @@ -112,11 +114,11 @@ public class TracingArgumentsParser { // Get screenshot period if (cmdline.hasOption(screenshotPeriod.getOpt())) { String period = cmdline.getOptionValue(screenshotPeriod.getOpt()); - if (period == null) { - result.setScreenshotPeriod(0); - } else { + if (period != null) { try{ int periodInt = Integer.parseInt(period); + if (periodInt < 0) + throw new NumberFormatException(); result.setScreenshotPeriod(periodInt); }catch(NumberFormatException nfe){ throw new ParseException( @@ -125,6 +127,11 @@ public class TracingArgumentsParser { } } + // Get on scene transition screenshot + if (cmdline.hasOption(screenshotTransition.getOpt())) { + result.setScreenshotOnSceneTransition(true); + } + // Get features TracingFeatureArgument.parseFeatureOptions(result, cmdline); @@ -176,11 +183,15 @@ public class TracingArgumentsParser { result.add(out); } + // screenshot on scene transition + if (args.getScreenshotOnSceneTransition()) + result.add('-' + screenshotTransition.getOpt()); + + // screenshot periodically int period = args.getScreenshotPeriod(); - if (args.isScreenshotPeriodSpecified()) { + if (period > 0) { result.add('-' + screenshotPeriod.getOpt()); - if (period > 0) - result.add(Integer.toString(period)); + result.add(Integer.toString(period)); } // Features diff --git a/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/tracing/TracingProcess.java b/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/tracing/TracingProcess.java index eea0180..44f96f0 100644 --- a/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/tracing/TracingProcess.java +++ b/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/tracing/TracingProcess.java @@ -13,7 +13,6 @@ import java.util.Arrays; import org.apache.commons.cli.ParseException; import org.tizen.dynamicanalyzer.cli.CliInternals; import org.tizen.dynamicanalyzer.cli.commands.ExitCode; -import org.tizen.dynamicanalyzer.cli.manager.ProcessManager; import org.tizen.dynamicanalyzer.cli.utils.Communicator; import org.tizen.dynamicanalyzer.cli.utils.ProcessCommunicationProcessor; import org.tizen.dynamicanalyzer.common.DAResult.ErrorCode; @@ -231,7 +230,8 @@ public class TracingProcess { } catch (NumberFormatException | IOException e) { System.exit(ExitCode.EX_CONNECTION_ERROR.getCode()); } - return ProcessManager.DEFAULT_PORT; + // unreachable instruction + return 0; } /** diff --git a/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/manager/ProcessManagerTest.java b/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/manager/ProcessManagerTest.java index ccdd564..1b5e740 100644 --- a/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/manager/ProcessManagerTest.java +++ b/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/manager/ProcessManagerTest.java @@ -6,10 +6,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.anyInt; -import static org.mockito.Matchers.eq; import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -35,7 +32,6 @@ import org.tizen.dynamicanalyzer.common.DAResult.ErrorCode; import org.tizen.dynamicanalyzer.setting.PrimitiveFeature; import org.tizen.dynamicanalyzer.util.InternalLogger; import org.tizen.dynamicanalyzer.util.Logger; -import org.tizen.sdblib.IDevice; /** * Test ProcessManager behavior. @@ -108,18 +104,17 @@ public class ProcessManagerTest { private void setupManagers() throws Exception { PowerMockito - .when(TracingProcessManager.createTracingProcess(eq(args1), - anyInt())).thenReturn(mgr1); + .when(TracingProcessManager.createTracingProcess(args1)) + .thenReturn(mgr1); Mockito.when(mgr1.getContext()).thenReturn(ctx1); Mockito.when(mgr1.isFinished()).thenReturn(false); PowerMockito - .when(TracingProcessManager.createTracingProcess(eq(args2), - anyInt())).thenReturn(mgr2); + .when(TracingProcessManager.createTracingProcess(args2)) + .thenReturn(mgr2); Mockito.when(mgr2.getContext()).thenReturn(ctx2); Mockito.when(mgr2.isFinished()).thenReturn(false); - IDevice mockDevice = mock(IDevice.class); PowerMockito.when(CliInternals.isDeviceExist(args2.getDevice())) .thenReturn(true); @@ -154,7 +149,7 @@ public class ProcessManagerTest { assertEquals(ErrorCode.SUCCESS.getErrorNumber(), result.getErrorNumber()); PowerMockito.verifyStatic(); - TracingProcessManager.createTracingProcess(args1, 9000); + TracingProcessManager.createTracingProcess(args1); assertEquals(ctx1, pm.getContext(args1.getDevice())); } diff --git a/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/manager/TracingProcessManagerTest.java b/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/manager/TracingProcessManagerTest.java index 6fcfa8c..5d640a3 100644 --- a/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/manager/TracingProcessManagerTest.java +++ b/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/manager/TracingProcessManagerTest.java @@ -14,6 +14,7 @@ import java.io.ObjectOutputStream; import java.io.OutputStream; import java.lang.reflect.Constructor; import java.net.InetAddress; +import java.net.ServerSocket; import java.net.Socket; import java.util.Date; import java.util.concurrent.Callable; @@ -33,6 +34,7 @@ import org.powermock.reflect.Whitebox; import org.tizen.dynamicanalyzer.cli.tracing.TracingArguments; import org.tizen.dynamicanalyzer.cli.utils.Message; import org.tizen.dynamicanalyzer.cli.utils.Message.MessageType; +import org.tizen.dynamicanalyzer.cli.utils.OppositeCommSide; import org.tizen.dynamicanalyzer.setting.PrimitiveFeature; import org.tizen.dynamicanalyzer.util.InternalLogger; import org.tizen.dynamicanalyzer.util.Logger; @@ -53,7 +55,7 @@ public class TracingProcessManagerTest { static ObjectInputStream ois; - static final int port = 9000; + static ServerSocket ss = OppositeCommSide.getServerSocket(); /** * Base time unit used in some test for sleep and timeout. */ @@ -107,7 +109,9 @@ public class TracingProcessManagerTest { args.setDuration(0); args.addFeature(PrimitiveFeature.CPU_USAGE); - managerConstructor = Whitebox.getConstructor(TracingProcessManager.class, TracingArguments.class, Process.class, int.class); + managerConstructor = Whitebox.getConstructor( + TracingProcessManager.class, TracingArguments.class, + Process.class, ServerSocket.class); } /** @@ -127,7 +131,7 @@ public class TracingProcessManagerTest { commThread.start(); // create class under test - manager = managerConstructor.newInstance(args, process, port); + manager = managerConstructor.newInstance(args, process, ss); ctx = manager.getContext(); assertFalse(manager.isFinished()); @@ -151,7 +155,7 @@ public class TracingProcessManagerTest { public void stopTracing_no_except() throws Exception { commThread.start(); // create class under test - manager = managerConstructor.newInstance(args, process, port); + manager = managerConstructor.newInstance(args, process, ss); manager.stopTracing(); assertEquals(MessageType.REQUEST__STOP_TRACING, @@ -182,7 +186,7 @@ public class TracingProcessManagerTest { }); // create class under test - manager = managerConstructor.newInstance(args, process, port); + manager = managerConstructor.newInstance(args, process, ss); // synchronization barrier while (!reached) { @@ -223,7 +227,7 @@ public class TracingProcessManagerTest { }); commThread.start(); // create class under test - manager = managerConstructor.newInstance(args, process, port); + manager = managerConstructor.newInstance(args, process, ss); assertFalse(manager.isFinished()); assertCurrentTime(manager.getContext().getStartTime().getTime()); @@ -260,7 +264,7 @@ public class TracingProcessManagerTest { }); // create class under test - manager = managerConstructor.newInstance(args, process, port); + manager = managerConstructor.newInstance(args, process, ss); assertFalse(manager.isFinished()); assertCurrentTime(manager.getContext().getStartTime().getTime()); @@ -310,7 +314,7 @@ public class TracingProcessManagerTest { }).when(process).destroy(); // create class under test - manager = managerConstructor.newInstance(args, process, port); + manager = managerConstructor.newInstance(args, process, ss); assertFalse(manager.isFinished()); assertCurrentTime(manager.getContext().getStartTime().getTime()); @@ -344,7 +348,7 @@ public class TracingProcessManagerTest { }); // create class under test - manager = managerConstructor.newInstance(args, process, port); + manager = managerConstructor.newInstance(args, process, ss); // synchronization barrier while (!reached) { @@ -418,7 +422,7 @@ public class TracingProcessManagerTest { }).when(process).destroy(); // create class under test - manager = managerConstructor.newInstance(args, process, port); + manager = managerConstructor.newInstance(args, process, ss); // call stopTracing in separate thread FutureTask stopTask = new FutureTask<>(new Callable() { @@ -457,7 +461,8 @@ public class TracingProcessManagerTest { public void run() { try { Thread.sleep(TIME_EPS_MS); - Socket socket = new Socket(InetAddress.getLocalHost(), port); + Socket socket = new Socket(InetAddress.getLocalHost(), + ss.getLocalPort()); ois = new ObjectInputStream(socket.getInputStream()); ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream()); oos.flush(); diff --git a/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/tracing/TracingArgumentsParserTest.java b/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/tracing/TracingArgumentsParserTest.java index fe3abf3..324aa11 100644 --- a/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/tracing/TracingArgumentsParserTest.java +++ b/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/tracing/TracingArgumentsParserTest.java @@ -4,6 +4,7 @@ package org.tizen.dynamicanalyzer.cli.tracing; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; @@ -29,17 +30,24 @@ public class TracingArgumentsParserTest { private final static String application = "application"; private final static String applicationOpt = "-a"; private final static PrimitiveFeature cpu = PrimitiveFeature.CPU_USAGE; + // Command line option for CPU feature group private final static String featureOptCPU = "-C=usage"; private final static PrimitiveFeature memory1 = PrimitiveFeature.SYSTEM_MEMORY; private final static PrimitiveFeature memory2 = PrimitiveFeature.PROCESS_MEMORY; + // Command line option for Memory feature group private final static String featureOptMEMORY = "-M"; private final static PrimitiveFeature file1 = PrimitiveFeature.DISK_IO; private final static PrimitiveFeature file2 = PrimitiveFeature.FILE_ANALYSIS; + // Command line option for File feature group private final static String featureOptFILE = "-F=all"; private final static PrimitiveFeature power = PrimitiveFeature.POWER_ESTIMATION; + // Command line option for Power estimation feature private final static String featureOptPOWER = "-E"; private final static PrimitiveFeature screenshot = PrimitiveFeature.SCREENSHOT; - private final static String featureOptSCREENSHOT = "-S"; + // Command line option for screenshot periodically preference + private final static String prefOptScreenPer = "-S"; + // Command line option for screenshot on scene transition preference + private final static String prefOptScreenOST = "-s"; private final static String period = "3"; private final static String output = "output.out"; private final static String outdefPrefix = File.separator+"test"+File.separator; @@ -63,7 +71,7 @@ public class TracingArgumentsParserTest { outputOpt, outdefPrefix + output, featureOptCPU, - featureOptSCREENSHOT, period + prefOptScreenPer, period // TODO duration option is not supported yet // durationOpt, Long.toString(duration) }); @@ -76,7 +84,7 @@ public class TracingArgumentsParserTest { assertEquals(2, result.getFeatures().size()); assertTrue(result.getFeatures().contains(cpu)); assertTrue(result.getFeatures().contains(screenshot)); - assertTrue(result.isScreenshotPeriodSpecified()); + assertFalse(result.getScreenshotOnSceneTransition()); assertEquals(Integer.parseInt(period), result.getScreenshotPeriod()); // TODO duration option is not supported yet // assertEquals(duration, result.getDuration()); @@ -271,27 +279,36 @@ public class TracingArgumentsParserTest { TracingArguments result = TracingArgumentsParser.parse(new String[] { device, applicationOpt, application, - featureOptSCREENSHOT }); + prefOptScreenOST }); assertNotNull(result); assertTrue(result.isValid()); assertNull(result.getOutput()); assertEquals(0, result.getDuration()); - assertTrue(result.isScreenshotPeriodSpecified()); + assertTrue(result.getScreenshotOnSceneTransition()); assertEquals(0, result.getScreenshotPeriod()); assertTrue(result.getFeatures().contains(PrimitiveFeature.SCREENSHOT)); } + @Test(expected = ParseException.class) + public void parse_screenshotsOnSceneTransitionWithArg() throws Exception { + TracingArguments result = TracingArgumentsParser.parse(new String[] { + device, + applicationOpt, application, + prefOptScreenOST, "3" }); + assertNull(result); + } + @Test public void parse_screenshotsPeriodically() throws Exception { TracingArguments result = TracingArgumentsParser.parse(new String[] { device, applicationOpt, application, - featureOptSCREENSHOT, period }); + prefOptScreenPer, period }); assertNotNull(result); assertTrue(result.isValid()); assertNull(result.getOutput()); assertEquals(0, result.getDuration()); - assertTrue(result.isScreenshotPeriodSpecified()); + assertFalse(result.getScreenshotOnSceneTransition()); assertEquals(Integer.parseInt(period), result.getScreenshotPeriod()); assertTrue(result.getFeatures().contains(PrimitiveFeature.SCREENSHOT)); } @@ -300,13 +317,13 @@ public class TracingArgumentsParserTest { public void parse_screenshotsOnSceneTransition_featureBeforeApp() throws Exception { TracingArguments result = TracingArgumentsParser.parse(new String[] { device, - featureOptSCREENSHOT, + prefOptScreenOST, applicationOpt, application }); assertNotNull(result); assertTrue(result.isValid()); assertNull(result.getOutput()); assertEquals(0, result.getDuration()); - assertTrue(result.isScreenshotPeriodSpecified()); + assertTrue(result.getScreenshotOnSceneTransition()); assertEquals(0, result.getScreenshotPeriod()); assertTrue(result.getFeatures().contains(screenshot)); } @@ -316,7 +333,8 @@ public class TracingArgumentsParserTest { TracingArguments result = TracingArgumentsParser.parse(new String[] { device, applicationOpt, application, - featureOptSCREENSHOT, "-"+period }); + prefOptScreenPer, + "-" + period }); assertNull(result); } @@ -325,7 +343,8 @@ public class TracingArgumentsParserTest { TracingArguments result = TracingArgumentsParser.parse(new String[] { device, applicationOpt, application, - featureOptSCREENSHOT, "S" }); + prefOptScreenPer, + "S" }); assertNull(result); } @@ -390,7 +409,7 @@ public class TracingArgumentsParserTest { .setApplication(application) .addFeature(cpu) .setOutput(output) - .setScreenshotPeriod(0); + .setScreenshotOnSceneTransition(true); String[] result = TracingArgumentsParser.toStringArray(args); assertNotNull(result); assertEquals(8, result.length); @@ -459,11 +478,11 @@ public class TracingArgumentsParserTest { TracingArguments args = new TracingArguments() .setDevice(device) .setApplication(application) - .setScreenshotPeriod(0); + .setScreenshotOnSceneTransition(true); String[] result = TracingArgumentsParser.toStringArray(args); assertNotNull(result); assertEquals(4, result.length); - assertEquals(featureOptSCREENSHOT, result[3]); + assertEquals(prefOptScreenOST, result[3]); } @Test @@ -475,7 +494,7 @@ public class TracingArgumentsParserTest { String[] result = TracingArgumentsParser.toStringArray(args); assertNotNull(result); assertEquals(5, result.length); - assertEquals(featureOptSCREENSHOT, result[3]); + assertEquals(prefOptScreenPer, result[3]); assertEquals(period, result[4]); } diff --git a/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/tracing/TracingArgumentsTest.java b/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/tracing/TracingArgumentsTest.java index 138cfbb..555c095 100644 --- a/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/tracing/TracingArgumentsTest.java +++ b/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/tracing/TracingArgumentsTest.java @@ -3,8 +3,6 @@ package org.tizen.dynamicanalyzer.cli.tracing; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -import java.io.File; - import org.junit.Before; import org.junit.Ignore; import org.junit.Test; @@ -143,4 +141,13 @@ public class TracingArgumentsTest { .setScreenshotPeriod(0); assertTrue(args.isValid()); } + + @Test + public void isValid_withOkTransition() { + TracingArguments args = new TracingArguments().setDevice(device) + .setApplication(application).addFeature(feature) + .setScreenshotOnSceneTransition(true); + assertTrue(args.isValid()); + } + } diff --git a/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/utils/CommunicatorTest.java b/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/utils/CommunicatorTest.java index 45a2a77..9aa359a 100644 --- a/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/utils/CommunicatorTest.java +++ b/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/utils/CommunicatorTest.java @@ -19,7 +19,6 @@ import org.tizen.dynamicanalyzer.cli.utils.Message.MessageType; */ public class CommunicatorTest { - final int PORT = 9000; Message sentMessage = null; @Before @@ -37,12 +36,13 @@ public class CommunicatorTest { */ @Test public void testSend() throws Exception { - ServerSocket ss = new ServerSocket(PORT); + final ServerSocket ss = OppositeCommSide.getServerSocket(); Thread commThread = new Thread(new Runnable() { @Override public void run() { try { - Socket socket = new Socket(InetAddress.getLocalHost(), PORT); + Socket socket = new Socket(InetAddress.getLocalHost(), + ss.getLocalPort()); ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream()); oos.flush(); ObjectInputStream ois = new ObjectInputStream(socket.getInputStream()); @@ -88,12 +88,13 @@ public class CommunicatorTest { */ @Test public void testSendByInternals() throws Exception { - ServerSocket ss = new ServerSocket(PORT); + final ServerSocket ss = OppositeCommSide.getServerSocket(); Thread commThread = new Thread(new Runnable() { @Override public void run() { try { - Socket socket = new Socket(InetAddress.getLocalHost(), PORT); + Socket socket = new Socket(InetAddress.getLocalHost(), + ss.getLocalPort()); ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream()); oos.flush(); ObjectInputStream ois = new ObjectInputStream(socket.getInputStream()); @@ -139,12 +140,13 @@ public class CommunicatorTest { */ @Test public void testSendByInternalsWithArgs() throws Exception { - ServerSocket ss = new ServerSocket(PORT); + final ServerSocket ss = OppositeCommSide.getServerSocket(); Thread commThread = new Thread(new Runnable() { @Override public void run() { try { - Socket socket = new Socket(InetAddress.getLocalHost(), PORT); + Socket socket = new Socket(InetAddress.getLocalHost(), + ss.getLocalPort()); ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream()); oos.flush(); ObjectInputStream ois = new ObjectInputStream(socket.getInputStream()); @@ -194,12 +196,13 @@ public class CommunicatorTest { */ @Test public void testGet() throws Exception { - ServerSocket ss = new ServerSocket(PORT); + final ServerSocket ss = OppositeCommSide.getServerSocket(); Thread commThread = new Thread(new Runnable() { @Override public void run() { try { - Socket socket = new Socket(InetAddress.getLocalHost(), PORT); + Socket socket = new Socket(InetAddress.getLocalHost(), + ss.getLocalPort()); ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream()); oos.flush(); ObjectInputStream ois = new ObjectInputStream(socket.getInputStream()); @@ -240,12 +243,13 @@ public class CommunicatorTest { */ @Test public void testGetWithArgs() throws Exception { - ServerSocket ss = new ServerSocket(PORT); + final ServerSocket ss = OppositeCommSide.getServerSocket(); Thread commThread = new Thread(new Runnable() { @Override public void run() { try { - Socket socket = new Socket(InetAddress.getLocalHost(), PORT); + Socket socket = new Socket(InetAddress.getLocalHost(), + ss.getLocalPort()); ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream()); oos.flush(); ObjectInputStream ois = new ObjectInputStream(socket.getInputStream()); diff --git a/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/utils/ManagerCommunicationProcessorTest.java b/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/utils/ManagerCommunicationProcessorTest.java index da5ab53..91758b0 100644 --- a/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/utils/ManagerCommunicationProcessorTest.java +++ b/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/utils/ManagerCommunicationProcessorTest.java @@ -26,8 +26,6 @@ import org.tizen.dynamicanalyzer.util.Logger; */ public class ManagerCommunicationProcessorTest { - static int PORT = 9000; - static ManagerCommunicationProcessor comProcessor; static TracingProcessContext ctx; @@ -45,8 +43,8 @@ public class ManagerCommunicationProcessorTest { @BeforeClass public static void setUp() throws IOException { Logger.init(InternalLogger.DEBUG); - ServerSocket ss = new ServerSocket(PORT); - opposite = new OppositeCommSide(PORT); + ServerSocket ss = OppositeCommSide.getServerSocket(); + opposite = new OppositeCommSide(ss.getLocalPort()); Thread oppThread = new Thread(opposite); oppThread.start(); Socket socket = ss.accept(); diff --git a/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/utils/OppositeCommSide.java b/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/utils/OppositeCommSide.java index 37c0eeb..808a8a9 100644 --- a/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/utils/OppositeCommSide.java +++ b/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/utils/OppositeCommSide.java @@ -4,6 +4,7 @@ import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.net.InetAddress; +import java.net.ServerSocket; import java.net.Socket; import org.junit.Ignore; @@ -67,4 +68,19 @@ public class OppositeCommSide implements Runnable { e.printStackTrace(); } } + + /** + * Method allocates available local socket. + * + * @return ServerSocket instance with free port. + */ + public static ServerSocket getServerSocket() { + while (true) { + try { + ServerSocket ss = new ServerSocket(0); + return ss; + } catch (IOException e) { + } + } + } } \ No newline at end of file diff --git a/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/utils/ProcessCommunicationProcessorTest.java b/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/utils/ProcessCommunicationProcessorTest.java index aac9ecb..fe62fdb 100644 --- a/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/utils/ProcessCommunicationProcessorTest.java +++ b/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/utils/ProcessCommunicationProcessorTest.java @@ -25,7 +25,6 @@ public class ProcessCommunicationProcessorTest { static Thread comThread; static OppositeCommSide opposite; - static int PORT = 10000; private static ProcessCommunicationProcessor comProcessor; private static TracingProcess process; private static Thread oppThread; @@ -39,8 +38,8 @@ public class ProcessCommunicationProcessorTest { @BeforeClass public static void setup() throws IOException { Logger.init(InternalLogger.DEBUG); - ServerSocket ss = new ServerSocket(PORT); - opposite = new OppositeCommSide(PORT); + ServerSocket ss = OppositeCommSide.getServerSocket(); + opposite = new OppositeCommSide(ss.getLocalPort()); oppThread = new Thread(opposite); oppThread.start(); Socket socket = ss.accept(); diff --git a/org.tizen.dynamicanalyzer.test/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/data/SettingDataManagerTest.java b/org.tizen.dynamicanalyzer.test/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/data/SettingDataManagerTest.java index ebc6df0..329d6ed 100644 --- a/org.tizen.dynamicanalyzer.test/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/data/SettingDataManagerTest.java +++ b/org.tizen.dynamicanalyzer.test/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/data/SettingDataManagerTest.java @@ -268,15 +268,9 @@ public class SettingDataManagerTest { feature = Feature.getFeature(ConfigureLabels.FEATURE_NAME_THREAD).getData(); assertEquals(Feature.THREAD_ANALYSIS.getIndex(), feature.getFeatureIndex()); - FeatureValueData featureValue = Whitebox.invokeMethod(setting, "getFeatureValueData", - (Object) setting.getOptionsSelectedFeatureList(), - (Object) Feature.getFeature(0)); - assertNull(featureValue); - // copyFeatureList() List source = new ArrayList(); List dest = new ArrayList(); - Whitebox.invokeMethod(setting, "copyFeatureList", (Object) source, (Object) dest); assertEquals(0, dest.size()); } catch (Exception e) { Logger.exception(e); @@ -301,28 +295,6 @@ public class SettingDataManagerTest { } @Test - public void testProtocolOperation() { - try { - int level = setting.getSelectedOverheadLevel("mobile"); - assertEquals(1, level); - - long featureOverheadValue = Whitebox.invokeMethod(setting, "getFeatureOverheadValue", - setting.getTarget("mobile"), Feature.OPENGL_ANALYSIS, false); - assertEquals(800000, featureOverheadValue); - - double count = Whitebox.invokeMethod(setting, "calculateCallcount", (Object) null, - (Object) Feature.FUNCTION_SAMPLING_RATE, true); - assertEquals(3000, count, 0); - - count = Whitebox.invokeMethod(setting, "calculateCallcount", setting.getTarget(null), - (Object) Feature.FUNCTION_SAMPLING_RATE, false); - assertEquals(3000, count, 0); - } catch (Exception e) { - Logger.exception(e); - } - } - - @Test public void testSettingOperation() { TargetData target = setting.getTarget("not-wearable"); assertNull(target); @@ -345,51 +317,6 @@ public class SettingDataManagerTest { assertEquals(2, list.size()); assertTrue(list.contains("CPU Usage")); assertTrue(list.contains("Core Usage")); - - // options tab feature - assertTrue(setting.isOptionsSelectedFeature(Feature.RECORDING)); - assertFalse(setting.isOptionsSelectedFeature(Feature.SCREENSHOT_PERIODICALLY)); - - setting.addOptionsSelectedFeature(Feature.SCREENSHOT_PERIODICALLY, 50); - assertTrue(setting.isOptionsSelectedFeature(Feature.SCREENSHOT_PERIODICALLY)); - - // selected value - int featureValue = setting.getOptionsFeatureValue(Feature.SCREENSHOT_PERIODICALLY); - assertEquals(50, featureValue); - - // init value - featureValue = setting.getOptionsFeaturInitValue(Feature.RECORDING); - assertEquals(0, featureValue); - - featureValue = setting.getOptionsFeaturInitValue(Feature.SCREENSHOT_PERIODICALLY); - assertEquals(10, featureValue); - - // options selected feature chart list - list = setting.getOptionsSelectedFeatureChartSet(); - assertEquals(1, list.size()); - assertTrue(list.contains("Screenshot")); - - setting.deleteOptionsSelectedFeature(Feature.SCREENSHOT_PERIODICALLY); - assertFalse(setting.isOptionsSelectedFeature(Feature.SCREENSHOT_PERIODICALLY)); - - // default value - featureValue = setting.getOptionsFeatureValue(Feature.SCREENSHOT_PERIODICALLY); - assertEquals(10, featureValue); - } - - @Test - public void testGetSelectedFeatures() { - Set selectedFeatures = setting.getSelectedFeatureSet(); - assertEquals(10, selectedFeatures.size()); - assertTrue(selectedFeatures.contains(Feature.SYSTEM)); - assertTrue(selectedFeatures.contains(Feature.SYSTEM_CPU)); - assertTrue(selectedFeatures.contains(Feature.SYSTEM_PROCESS)); - assertTrue(selectedFeatures.contains(Feature.SYSTEM_ALL_PROCESSES)); - assertTrue(selectedFeatures.contains(Feature.SYSTEM_SAMPLING_RATE)); - assertTrue(selectedFeatures.contains(Feature.FUNCTION_PROFILING)); - assertTrue(selectedFeatures.contains(Feature.FUNCTION_SAMPLING)); - assertTrue(selectedFeatures.contains(Feature.FUNCTION_SAMPLING_RATE)); - assertTrue(selectedFeatures.contains(Feature.RECORDING)); } @Test diff --git a/org.tizen.dynamicanalyzer.test/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/data/TargetDataTest.java b/org.tizen.dynamicanalyzer.test/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/data/TargetDataTest.java index 6aaffc6..c0dbdfc 100644 --- a/org.tizen.dynamicanalyzer.test/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/data/TargetDataTest.java +++ b/org.tizen.dynamicanalyzer.test/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/data/TargetDataTest.java @@ -94,7 +94,7 @@ public class TargetDataTest { @AfterClass public static void tesApplySettingData() { // check initial FlatFeature set - Set initFlatFeatureSet = Whitebox.getInternalState(targetData, "initFlatFeatureSet"); + ArrayList initFlatFeatureSet = Whitebox.getInternalState(targetData, "initFlatFeatures"); targetData.addSelectedFlatFeature(FlatFeature.CPU_USAGE.getName()); @@ -102,14 +102,15 @@ public class TargetDataTest { targetData.applySettingData(); //check that settings applied - Set newInitFlatFeatureSet = Whitebox.getInternalState(targetData, "initFlatFeatureSet"); + ArrayList newInitFlatFeatureSet = Whitebox.getInternalState(targetData, "initFlatFeatures"); assertEquals(targetData.getSelectedFlatFeatures().size(), initFlatFeatureSet.size()); assertTrue(newInitFlatFeatureSet.containsAll(targetData.getSelectedFlatFeatures())); } @Test public void testMakeAvailableFlatFeatureList() { - Set availableFlatFeatureSet = targetData.getAvailableFlatFeatures(); + List availableFlatFeatureSet = targetData + .getAvailableFlatFeatures(); assertEquals(FlatFeature.values().length, availableFlatFeatureSet.size()); for (FlatFeature feature : FlatFeature.values()) { @@ -134,12 +135,13 @@ public class TargetDataTest { @Test public void testMakeSelectedFlatFeatureList() { // check selectedFeatureList - Set selectedFlatFeatures = targetData.getSelectedFlatFeatures(); + List selectedFlatFeatures = targetData + .getSelectedFlatFeatures(); assertEquals(1, selectedFlatFeatures.size()); assertTrue(selectedFlatFeatures.contains(FlatFeature.SYSTEM_MEMORY)); // check initFeatureList - Set initFlatFeatureSet = Whitebox.getInternalState(targetData, "initFlatFeatureSet"); + ArrayList initFlatFeatureSet = Whitebox.getInternalState(targetData, "initFlatFeatures"); assertEquals(1, initFlatFeatureSet.size()); assertTrue(initFlatFeatureSet.contains(FlatFeature.SYSTEM_MEMORY)); @@ -264,8 +266,8 @@ public class TargetDataTest { Logger.error(e); } // check initial FlatFeature set - Set initFlatFeatureSet = Whitebox.getInternalState( - targetData, "initFlatFeatureSet"); + ArrayList initFlatFeatureSet = Whitebox.getInternalState( + targetData, "initFlatFeatures"); assertEquals(1, initFlatFeatureSet.size()); assertTrue(initFlatFeatureSet.contains(FlatFeature.SYSTEM_MEMORY)); } @@ -273,8 +275,8 @@ public class TargetDataTest { @Test public void testRevertSettingData() { // check initial FlatFeature set - Set initFlatFeatureSet = Whitebox.getInternalState( - targetData, "initFlatFeatureSet"); + ArrayList initFlatFeatureSet = Whitebox.getInternalState( + targetData, "initFlatFeatures"); assertEquals(1, initFlatFeatureSet.size()); // change selected FlatFeatures diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AnalyzerConstants.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AnalyzerConstants.java index efaa6dd..15812c9 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AnalyzerConstants.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AnalyzerConstants.java @@ -155,6 +155,7 @@ public class AnalyzerConstants { /* value for ID */ public static final int UNKNOWN_ID = -1; // ID resolving is valid, but cannot found public static final int INVALID_ID = -2; // ID resolving is not valid + public static final int MAIN_EXECUTABLE_ID = -10; /* save return values */ public static final int ERROR_EXTENSION_FAIL = -1; diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/CommunicatorUtils.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/CommunicatorUtils.java index 447d804..0569067 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/CommunicatorUtils.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/CommunicatorUtils.java @@ -178,7 +178,7 @@ public class CommunicatorUtils { SyncService service = device.getSyncService(); if (null != service) { result = service.doPull(device.getFileEntry(remote), fileOut, - NullSyncProgressMonitor.getInstance(), -1); + NullSyncProgressMonitor.getInstance(), 0); service.close(); } } catch (TimeoutException e) { diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/database/DBTable.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/database/DBTable.java index 1b444a1..ba80884 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/database/DBTable.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/database/DBTable.java @@ -36,6 +36,11 @@ import org.tizen.dynamicanalyzer.constant.CommonConstants; import org.tizen.dynamicanalyzer.util.Logger; public abstract class DBTable implements IPreparedStatement, IResultSet { + /** + * Query to select all data from table. + */ + protected static final String SELECT_ALL_QUERY = "select * from %s"; + private List columns = new ArrayList(); protected DBInserter dbInserter = null; @@ -147,6 +152,16 @@ public abstract class DBTable implements IPreparedStatement, IResultSet { } } + /** + * Select all data from this table. + * + * @return list of rows where row is list of objects, + * null if there is no data in the table + */ + public final List> selectAllObjectData() { + return SqlConnectionManager.executeQuery(String.format(SELECT_ALL_QUERY, getTableName())); + } + public final List> selectAllColumnData(String option) { return selectData(null, option, this); } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/handlers/CLIAction.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/handlers/CLIAction.java index a41aaa5..55d1563 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/handlers/CLIAction.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/handlers/CLIAction.java @@ -120,7 +120,7 @@ public class CLIAction implements UIAction { */ private String getCurrentTargetName() { String targetName = null; - TargetData target = SettingDataManager.INSTANCE.getConnectedTarget(); + TargetData target = SettingDataManager.INSTANCE.getConnectedTargetOrSelected(); if (target != null) targetName = target.getTargetName(); return targetName; diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/handlers/GUIAction.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/handlers/GUIAction.java index 35aa982..c009476 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/handlers/GUIAction.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/handlers/GUIAction.java @@ -265,7 +265,7 @@ public class GUIAction implements UIAction { @Override public void setPageBySetting() { - TargetData target = SettingDataManager.INSTANCE.getConnectedTarget(); + TargetData target = SettingDataManager.INSTANCE.getConnectedTargetOrSelected(); final String targetName = target.getTargetName(); Display.getDefault().syncExec(new Runnable() { @@ -287,7 +287,7 @@ public class GUIAction implements UIAction { final Set selectedChartSet = new HashSet(); // set selected chart list - TargetData target = SettingDataManager.INSTANCE.getConnectedTarget(); + TargetData target = SettingDataManager.INSTANCE.getConnectedTargetOrSelected(); Set targetChartList = SettingDataManager.INSTANCE.getSelectedChartSet(target .getTargetName()); selectedChartSet.addAll(targetChartList); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/TimelinePageLabels.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/TimelinePageLabels.java index 0a2c284..f68f139 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/TimelinePageLabels.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/TimelinePageLabels.java @@ -46,6 +46,7 @@ public class TimelinePageLabels extends NLS { public static String UI_EVENT_LIST_NAME; public static String UI_EVENT_LIST_TIME; public static String UI_EVENT_LIST_DETAIL; + public static String APPSTARTUP_NOT_SUPPORTED_LABEL; static { // initialize resource bundle NLS.initializeMessages(BUNDLE_NAME, TimelinePageLabels.class); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/TimelinePageLabels.properties b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/TimelinePageLabels.properties index 0c2244b..cccc016 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/TimelinePageLabels.properties +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/TimelinePageLabels.properties @@ -10,4 +10,6 @@ CALL_TRACE_VIEW_LINE_NUMBER=Line number UI_EVENT_LIST_TYPE=Type UI_EVENT_LIST_NAME=Name UI_EVENT_LIST_TIME=Time -UI_EVENT_LIST_DETAIL=Detail \ No newline at end of file +UI_EVENT_LIST_DETAIL=Detail + +APPSTARTUP_NOT_SUPPORTED_LABEL=Startup info cannot be collected when UI Hierarchy Analysis is selected. \ No newline at end of file diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/setting/SettingDataManager.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/setting/SettingDataManager.java index ad64fd2..8e5e9df 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/setting/SettingDataManager.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/setting/SettingDataManager.java @@ -49,9 +49,6 @@ import org.tizen.dynamicanalyzer.communicator.DeviceInfo; import org.tizen.dynamicanalyzer.constant.CommonConstants; import org.tizen.dynamicanalyzer.nl.TimelineChartLabels; import org.tizen.dynamicanalyzer.protocol.DebugLog; -import org.tizen.dynamicanalyzer.protocol.IProtocolConfig; -import org.tizen.dynamicanalyzer.protocol.Protocol; -import org.tizen.dynamicanalyzer.protocol.UnknownProtocolException; import org.tizen.dynamicanalyzer.ui.page.BaseView; import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage; import org.tizen.dynamicanalyzer.util.CommonUtil; @@ -73,12 +70,10 @@ public enum SettingDataManager { /** write information **/ // init selected information : for revert button private String initTarget = null; - private List initOptionsSelectedFeatureList = new ArrayList(); private List initOptionsSelectedPreferenceList = new ArrayList(); // mutable information private String selectedTarget = null; - private List optionsSelectedFeatureList = new ArrayList(); private List optionsSelectedPreferenceList = new ArrayList(); // available target list @@ -259,20 +254,7 @@ public enum SettingDataManager { totalOverheadRange.add(Long.parseLong(list[i])); } } else if (list[0].equals(SettingConstants.KEY_OPTIONS_SELECTED_FEATURE_LIST)) { - for (int i = 1; i < list.length; i++) { - String valueList[] = list[i].split(CommonConstants.COLON); - FeatureValueData feature = new FeatureValueData(Feature.getFeature(Integer - .parseInt(valueList[0]))); - - if (valueList.length > 1) { - feature.setValue(Integer.parseInt(valueList[1])); - } // else : feature is on/off type - - optionsSelectedFeatureList.add(feature); - } - - // init Feature list - copyFeatureList(optionsSelectedFeatureList, initOptionsSelectedFeatureList); + // do nothing } else if (list[0].equals(SettingConstants.KEY_SELECTED_PREFERENCES)) { for (int i = 1; i < list.length; i++) { String valueList[] = list[i].split(CommonConstants.COLON); @@ -345,8 +327,6 @@ public enum SettingDataManager { printWriter.println(writeDefaultFeatureList(SettingConstants.KEY_DEFAULT_FEATURE_LIST)); printWriter.println(writeCollection(totalOverheadRange, SettingConstants.KEY_TOTAL_OVERHEAD_RANGE)); - printWriter.println(SettingConstants.KEY_OPTIONS_SELECTED_FEATURE_LIST - + SettingConstants.WRITE_CSV_SEPARATOR + writeOptionsSelectedFeatureListData()); printWriter.println(SettingConstants.KEY_SELECTED_PREFERENCES + SettingConstants.WRITE_CSV_SEPARATOR + writeOptionsSelectedPreferencesListData()); @@ -408,23 +388,7 @@ public enum SettingDataManager { return buffer.toString(); } - private String writeOptionsSelectedFeatureListData() { - StringBuffer buffer = new StringBuffer(); - for (int i = 0; i < optionsSelectedFeatureList.size(); i++) { - FeatureValueData feature = optionsSelectedFeatureList.get(i); - buffer.append(feature.getKey().getIndex()); - if (feature.getValue() >= 0) { // detail feature - buffer.append(String.valueOf(CommonConstants.COLON + feature.getValue())); - } // else : (main feature or sub feature) feature does not have a value. - - if (i < optionsSelectedFeatureList.size() - 1) { - buffer.append(SettingConstants.WRITE_CSV_SEPARATOR); - } // else : the last value will be written to a csv file does not contain a comma. - } - return buffer.toString(); - } - private String writeOptionsSelectedPreferencesListData() { StringBuffer buffer = new StringBuffer(); for (int i = 0; i < optionsSelectedPreferenceList.size(); i++) { @@ -443,108 +407,17 @@ public enum SettingDataManager { } /****************************** protocol operation ******************************/ + @Deprecated public int getSelectedOverheadLevel(String targetName) { - int totalRange = 0; - long calculateValue = 0; - - // get target information - TargetData target = getTarget(targetName); - if (null != target) { - // option page overhead - for (int i = 0; i < optionsSelectedFeatureList.size(); i++) { - calculateValue += getFeatureOverheadValue(target, optionsSelectedFeatureList.get(i) - .getKey(), true); - } - - // get selected feature - List featureList = target.getSelectedFeatureList(); - for (int i = 0; i < featureList.size(); i++) { - calculateValue += getFeatureOverheadValue(target, featureList.get(i).getKey(), - false); - } - } - - // check total overhead range - for (int i = 0; i < totalOverheadRange.size(); i++) { - if (calculateValue <= totalOverheadRange.get(i)) { - return i + 1; - } - - if ((i == totalOverheadRange.size() - 1) - && (totalOverheadRange.get(i) < calculateValue)) { - return totalOverheadRange.size() + 1; - } - } - - return totalRange; - } - - private long getFeatureOverheadValue(TargetData target, Feature feature, boolean isOption) { - long calculateValue = 0; - - // get feature information - IProtocolConfig[] pconfigs = null; - try { - pconfigs = Protocol.getProtocolConfig(target.getProtocolVersion(), feature); - } catch (UnknownProtocolException e) { - Logger.warning(e.getMessage()); - } - - if (pconfigs != null) { - for (int i = 0; i < pconfigs.length; i++) { - long overhead = (long) pconfigs[i].getOverhead(); - int callcount = pconfigs[i].getCallcount(); - if (callcount > 0) { - calculateValue += (overhead * callcount); - } else if (pconfigs[i].getFeatureForFrequency() != null) { - Feature featureForFrequency = pconfigs[i].getFeatureForFrequency(); - calculateValue += (overhead * calculateCallcount(target, featureForFrequency, - isOption)); - } // else : do nothing - } - } - - return calculateValue; - } - - private double calculateCallcount(TargetData target, Feature featureForFrequency, - boolean isOption) { - // get input value - int inputValue = 0; - double count = 0; - - if (isOption) { // options feature - inputValue = getOptionsFeatureValue(featureForFrequency); - } else { - inputValue = target.getSelectedFeatureValue(featureForFrequency); - if (inputValue < 0) { - inputValue = featureForFrequency.getData().getDefaultValue(); - } - } - - // calculate - if (featureForFrequency == Feature.SYSTEM_SAMPLING_RATE - || featureForFrequency == Feature.FUNCTION_SAMPLING_RATE) { - count = 1000.0 / inputValue; // millisecond - } else if (featureForFrequency == Feature.SCREENSHOT_PERIODICALLY) { - count = 1.0 / inputValue; // second - } - - return count * SettingConstants.OVERHEAD_AVG_SECONDS; + return 0; } /********************************** chart set manipulation ***************************/ + + @Deprecated public Set getOptionsSelectedFeatureChartSet() { - Set selectedChartSet = new HashSet(); - for (int i = 0; i < optionsSelectedFeatureList.size(); i++) { - FeatureData feature = optionsSelectedFeatureList.get(i).getKey().getData(); - if (feature.getChartList().size() > 0) { - selectedChartSet.addAll(feature.getChartList()); - } - } - return selectedChartSet; + return new HashSet(); } - /** * Get chart information shown on the screen. * @@ -556,7 +429,7 @@ public enum SettingDataManager { TargetData target = getTarget(targetName); if (null != target) { Set selectedChartSet = new HashSet(); - Set featureSet = target.getSelectedFlatFeatures(); + List featureSet = target.getSelectedFlatFeatures(); for (FlatFeature feature : featureSet) { if (feature.getChart() != null) selectedChartSet.add(feature.getChart()); @@ -595,7 +468,7 @@ public enum SettingDataManager { * * @return device description as an instance of {@link TargetData} or null */ - public TargetData getConnected() { + public TargetData getConnectedTargetOrNull() { DeviceInfo currentDevice = Global.getCurrentDeviceInfo(); @@ -617,7 +490,7 @@ public enum SettingDataManager { * equals to selected target. */ public boolean checkConnectedTargetType() { - TargetData connected = getConnected(); + TargetData connected = getConnectedTargetOrNull(); if (connected == null) // User should be able to select any target if no // device connected. return true; @@ -630,8 +503,8 @@ public enum SettingDataManager { * * @return device description as an instance of {@link TargetData} or null */ - public TargetData getConnectedTarget() { - TargetData tData = getConnected(); + public TargetData getConnectedTargetOrSelected() { + TargetData tData = getConnectedTargetOrNull(); if (tData != null) return tData; @@ -639,27 +512,22 @@ public enum SettingDataManager { } /********************************** Feature manipulation ******************************/ + @Deprecated public List getDefaultFeatureList() { return Collections.unmodifiableList(defaultFeatureList); } + @Deprecated public List getOptionsSelectedFeatureList() { - return Collections.unmodifiableList(optionsSelectedFeatureList); + return new ArrayList(); } public List getOptionsSelectedPreferencesList() { return Collections.unmodifiableList(optionsSelectedPreferenceList); } + @Deprecated public void addOptionsSelectedFeature(Feature feature, int featureValue) { - FeatureValueData featureData = getFeatureValueData(optionsSelectedFeatureList, feature); - // create FeatureValueData - if (featureData == null) { - featureData = new FeatureValueData(feature); - optionsSelectedFeatureList.add(featureData); - } // else : set value - - featureData.setValue(featureValue); } public void addOptionsSelectedPreference(FlatPreferences feature, int featureValue) { @@ -675,13 +543,8 @@ public enum SettingDataManager { } } + @Deprecated public void deleteOptionsSelectedFeature(Feature feature) { - for (int i = 0; i < optionsSelectedFeatureList.size(); i++) { - if (optionsSelectedFeatureList.get(i).getKey() == feature) { - optionsSelectedFeatureList.remove(i); - break; - } // else : do nothing - } } public void deleteOptionsSelectedPreference(FlatPreferences feature) { @@ -693,13 +556,9 @@ public enum SettingDataManager { } } + @Deprecated public boolean isOptionsSelectedFeature(Feature feature) { - FeatureValueData featureVal = getFeatureValueData(optionsSelectedFeatureList, feature); - if (featureVal != null) { - return true; - } else { - return false; - } + return false; } public boolean isOptionsSelectedPrefereces(FlatPreferences feature) { @@ -722,19 +581,9 @@ public enum SettingDataManager { return getSelectedFlatFeatureSet().contains(feature); } + @Deprecated public int getOptionsFeatureValue(Feature feature) { - int value = 0; - FeatureValueData featureVal = getFeatureValueData(optionsSelectedFeatureList, feature); - - // check selected feature - if (featureVal != null) { - value = featureVal.getValue(); - } else { - // get default value - value = feature.getData().getDefaultValue(); - } - - return value; + return -1; } public int getOptionsPreferencesValue(FlatPreferences feature) { @@ -752,37 +601,11 @@ public enum SettingDataManager { return value; } + @Deprecated public int getOptionsFeaturInitValue(Feature feature) { - // get init value - int value = -1; - for (int i = 0; i < initOptionsSelectedFeatureList.size(); i++) { - if (initOptionsSelectedFeatureList.get(i).getKey() == feature) { - value = initOptionsSelectedFeatureList.get(i).getValue(); - break; - } - } - - // get default value - if (value == -1) { - value = feature.getData().getDefaultValue(); - } - return value; + return -1; } - private FeatureValueData getFeatureValueData(List featureList, Feature feature) { - // null check - if ((featureList == null) || (feature == null)) { - return null; - } // else : search FeatureValueData object - - for (int i = 0; i < featureList.size(); i++) { - if (featureList.get(i).getKey() == feature) { - return featureList.get(i); - } // else : do nothing - } - return null; - } - private int getFlatPreferences(List featureList, FlatPreferences feature) { if ((featureList == null) || (feature == null)) { return -1; @@ -817,8 +640,8 @@ public enum SettingDataManager { TargetData target = getTarget(targetName); if (null != target) { - Set featureSet = target.getSelectedFlatFeatures(); - for (FlatFeature feature : featureSet) { + List features = target.getSelectedFlatFeatures(); + for (FlatFeature feature : features) { if (feature.getPage() != null) selectedPageList.add(feature.getPage()); } @@ -829,18 +652,6 @@ public enum SettingDataManager { } /******************************* miscellaneous **********************************/ - private void copyFeatureList(List source, List dest) { - dest.clear(); - - if (source.isEmpty()) { - return; - } - - for (int i = 0; i < source.size(); i++) { - dest.add(new FeatureValueData(source.get(i))); - } - } - public boolean changedFeatures() { // check target if (initTarget.equals(selectedTarget) == false) { @@ -853,7 +664,7 @@ public enum SettingDataManager { } for (int i = 0; i < optionsSelectedPreferenceList.size(); i++) { - // check featureName + // check preferenceName FlatPreferences preference = optionsSelectedPreferenceList.get(i); int initPreferenceIndex = getFlatPreferences(initOptionsSelectedPreferenceList, preference); if (initPreferenceIndex < 0) { @@ -924,29 +735,13 @@ public enum SettingDataManager { writeSettingFile(); } + @Deprecated public Set getSelectedFeatureSet() { - Set selectedFeatures = new HashSet(); - - // add default features - selectedFeatures.addAll(defaultFeatureList); - - // add selected target features - TargetData target = getConnectedTarget(); - List featureList = target.getSelectedFeatureList(); - for (int i = 0; i < featureList.size(); i++) { - selectedFeatures.add(featureList.get(i).getKey()); - } - - // add option features - for (int i = 0; i < optionsSelectedFeatureList.size(); i++) { - selectedFeatures.add(optionsSelectedFeatureList.get(i).getKey()); - } - - return selectedFeatures; + return new HashSet(); } public Set getSelectedPreferenceSet() { - Set featureSet = getConnectedTarget() + List featureSet = getConnectedTargetOrSelected() .getSelectedFlatFeatures(); Set selectedFeatures = new HashSet(); @@ -972,17 +767,17 @@ public enum SettingDataManager { return selectedFeatures; } - // TODO: Function related with will replace functions + /** + * Returns selected FlatFeatures for selected target. + * + * @return unmodified set of selected FlatFeatures ordered by selection + * order + */ public Set getSelectedFlatFeatureSet() { - Set selectedFlatFeatures = new HashSet(); - - // add selected target features - TargetData target = getConnectedTarget(); - Set featureSet = target.getSelectedFlatFeatures(); - selectedFlatFeatures.addAll(featureSet); - Logger.debug(selectedFlatFeatures); - - return selectedFlatFeatures; + TargetData target = getTarget(null); + Set buf = new HashSet(); + buf.addAll(target.getSelectedFlatFeatures()); + return buf; } public boolean isPlatformDA() { @@ -990,6 +785,7 @@ public enum SettingDataManager { } // TODO : another function is implemented, will be deleted. + @Deprecated public String getPlatform() { // if (null == platform || platform.isEmpty() || // platform.equals(ConfigureLabels.PLATFORM_ETC)) { @@ -1014,7 +810,7 @@ public enum SettingDataManager { * @param enable whether Screenshot feature should be enabled */ public void enableScreenshotFeature(boolean enable) { - TargetData target = getConnectedTarget(); + TargetData target = getConnectedTargetOrSelected(); Set targetChartList = getSelectedChartSet(target.getTargetName()); if (!targetChartList.contains(TimelineChartLabels.SCREENSHOT_CHART_TITLE)) { BaseView baseView = (BaseView) WorkbenchUtil.getViewPart(BaseView.ID); @@ -1025,7 +821,7 @@ public enum SettingDataManager { if (enable) target.addSelectedFlatFeature(FlatFeature.SCREENSHOT.getName()); else - target.removeSelectedFeature(FlatFeature.SCREENSHOT.getName()); + target.removeSelectedFlatFeature(FlatFeature.SCREENSHOT.getName()); } } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/setting/TargetData.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/setting/TargetData.java index c7b5ecb..3e1703f 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/setting/TargetData.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/setting/TargetData.java @@ -29,14 +29,12 @@ import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; -import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; import org.tizen.dynamicanalyzer.constant.CommonConstants; import org.tizen.dynamicanalyzer.protocol.Protocol; -import org.tizen.dynamicanalyzer.util.Logger; public class TargetData { /** read information **/ @@ -44,20 +42,14 @@ public class TargetData { private Protocol protocolVersion = Protocol.VERSION_UNKNOWN; // available information - private List