From 3e7946567173a6ade9b2625d886828ca0f941a54 Mon Sep 17 00:00:00 2001 From: Nils Christian Ehmke <nie@informatik.uni-kiel.de> Date: Thu, 29 Jan 2015 14:30:27 +0100 Subject: [PATCH] Removed the record view (and the corresponding part in the analysis). --- .../importer/ImportAnalysisConfiguration.java | 9 +- .../importer/stages/RecordSimplificator.java | 47 ----- .../stages/RecordSimplificatorComposite.java | 90 ---------- .../java/kieker/gui/mainview/Controller.java | 31 ++-- src/main/java/kieker/gui/mainview/View.java | 8 - .../gui/subview/records/Controller.java | 60 ------- .../java/kieker/gui/subview/records/View.java | 160 ------------------ .../util/RecordTimestampComparator.java | 35 ---- .../records/util/RecordTypeComparator.java | 35 ---- .../stages/RecordSimplificatorTest.java | 51 ------ 10 files changed, 14 insertions(+), 512 deletions(-) delete mode 100644 src/main/java/kieker/gui/common/model/importer/stages/RecordSimplificator.java delete mode 100644 src/main/java/kieker/gui/common/model/importer/stages/RecordSimplificatorComposite.java delete mode 100644 src/main/java/kieker/gui/subview/records/Controller.java delete mode 100644 src/main/java/kieker/gui/subview/records/View.java delete mode 100644 src/main/java/kieker/gui/subview/records/util/RecordTimestampComparator.java delete mode 100644 src/main/java/kieker/gui/subview/records/util/RecordTypeComparator.java delete mode 100644 src/test/java/kieker/gui/common/model/importer/stages/RecordSimplificatorTest.java diff --git a/src/main/java/kieker/gui/common/model/importer/ImportAnalysisConfiguration.java b/src/main/java/kieker/gui/common/model/importer/ImportAnalysisConfiguration.java index 2a74026b..37f634e0 100644 --- a/src/main/java/kieker/gui/common/model/importer/ImportAnalysisConfiguration.java +++ b/src/main/java/kieker/gui/common/model/importer/ImportAnalysisConfiguration.java @@ -27,7 +27,6 @@ import kieker.gui.common.domain.AggregatedExecution; import kieker.gui.common.domain.Execution; import kieker.gui.common.domain.Record; import kieker.gui.common.model.importer.stages.ReadingComposite; -import kieker.gui.common.model.importer.stages.RecordSimplificatorComposite; import kieker.gui.common.model.importer.stages.TraceAggregationComposite; import kieker.gui.common.model.importer.stages.TraceReconstructionComposite; import teetime.framework.AnalysisConfiguration; @@ -36,8 +35,6 @@ import teetime.framework.pipe.PipeFactoryRegistry.PipeOrdering; import teetime.framework.pipe.PipeFactoryRegistry.ThreadCommunication; import teetime.stage.CollectorSink; import teetime.stage.MultipleInstanceOfFilter; -import teetime.stage.basic.distributor.CopyByReferenceStrategy; -import teetime.stage.basic.distributor.Distributor; /** * A configuration for the import and analysis of monitoring logs. @@ -62,8 +59,6 @@ public final class ImportAnalysisConfiguration extends AnalysisConfiguration { // Create the stages final ReadingComposite reader = new ReadingComposite(importDirectory); final MultipleInstanceOfFilter<IMonitoringRecord> typeFilter = new MultipleInstanceOfFilter<>(); - final Distributor<IFlowRecord> distributor = new Distributor<>(new CopyByReferenceStrategy()); - final RecordSimplificatorComposite recordSimplificator = new RecordSimplificatorComposite(this.records); final TraceReconstructionComposite traceReconstruction = new TraceReconstructionComposite(this.traces, this.failedTraces, this.failureContainingTraces); final TraceAggregationComposite traceAggregation = new TraceAggregationComposite(this.aggregatedTraces, this.failedAggregatedTraces, this.failureContainingAggregatedTraces); @@ -72,9 +67,7 @@ public final class ImportAnalysisConfiguration extends AnalysisConfiguration { // Connect the stages final IPipeFactory pipeFactory = AnalysisConfiguration.PIPE_FACTORY_REGISTRY.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false); pipeFactory.create(reader.getOutputPort(), typeFilter.getInputPort()); - pipeFactory.create(typeFilter.getOutputPortForType(IFlowRecord.class), distributor.getInputPort()); - pipeFactory.create(distributor.getNewOutputPort(), recordSimplificator.getInputPort()); - pipeFactory.create(distributor.getNewOutputPort(), traceReconstruction.getInputPort()); + pipeFactory.create(typeFilter.getOutputPortForType(IFlowRecord.class), traceReconstruction.getInputPort()); pipeFactory.create(traceReconstruction.getOutputPort(), traceAggregation.getInputPort()); pipeFactory.create(typeFilter.getOutputPortForType(KiekerMetadataRecord.class), metadataCollector.getInputPort()); diff --git a/src/main/java/kieker/gui/common/model/importer/stages/RecordSimplificator.java b/src/main/java/kieker/gui/common/model/importer/stages/RecordSimplificator.java deleted file mode 100644 index e4df7aef..00000000 --- a/src/main/java/kieker/gui/common/model/importer/stages/RecordSimplificator.java +++ /dev/null @@ -1,47 +0,0 @@ -/*************************************************************************** - * Copyright 2014 Kieker Project (http://kieker-monitoring.net) - * - * 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 kieker.gui.common.model.importer.stages; - -import kieker.common.record.IMonitoringRecord; -import kieker.gui.common.domain.Record; -import teetime.framework.AbstractConsumerStage; -import teetime.framework.OutputPort; - -/** - * Converts incoming instances of {@link IMonitoringRecord} into simplified representations ({@link Record}) used within this application. - * - * @author Nils Christian Ehmke - */ -final class RecordSimplificator extends AbstractConsumerStage<IMonitoringRecord> { - - private final OutputPort<Record> outputPort = super.createOutputPort(); - - @Override - protected void execute(final IMonitoringRecord input) { - final long timestamp = input.getLoggingTimestamp(); - final String type = input.getClass().getCanonicalName(); - final String representation = input.toString(); - - final Record simplifiedRecord = new Record(timestamp, type, representation); - this.outputPort.send(simplifiedRecord); - } - - public OutputPort<Record> getOutputPort() { - return this.outputPort; - } - -} diff --git a/src/main/java/kieker/gui/common/model/importer/stages/RecordSimplificatorComposite.java b/src/main/java/kieker/gui/common/model/importer/stages/RecordSimplificatorComposite.java deleted file mode 100644 index a30a2ec6..00000000 --- a/src/main/java/kieker/gui/common/model/importer/stages/RecordSimplificatorComposite.java +++ /dev/null @@ -1,90 +0,0 @@ -/*************************************************************************** - * Copyright 2014 Kieker Project (http://kieker-monitoring.net) - * - * 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 kieker.gui.common.model.importer.stages; - -import java.util.List; - -import kieker.common.record.IMonitoringRecord; -import kieker.gui.common.domain.Record; -import teetime.framework.InputPort; -import teetime.framework.Stage; -import teetime.framework.TerminationStrategy; -import teetime.framework.pipe.IPipeFactory; -import teetime.framework.pipe.PipeFactoryRegistry; -import teetime.framework.pipe.PipeFactoryRegistry.PipeOrdering; -import teetime.framework.pipe.PipeFactoryRegistry.ThreadCommunication; -import teetime.framework.signal.ISignal; -import teetime.framework.validation.InvalidPortConnection; -import teetime.stage.CollectorSink; - -public final class RecordSimplificatorComposite extends Stage { - - private final RecordSimplificator simplificator; - private final CollectorSink<Record> collector; - - public RecordSimplificatorComposite(final List<Record> records) { - this.simplificator = new RecordSimplificator(); - this.collector = new CollectorSink<>(records); - - final IPipeFactory pipeFactory = PipeFactoryRegistry.INSTANCE.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false); - pipeFactory.create(this.simplificator.getOutputPort(), this.collector.getInputPort()); - } - - @Override - protected void executeWithPorts() { - this.simplificator.executeWithPorts(); - } - - public InputPort<IMonitoringRecord> getInputPort() { - return this.simplificator.getInputPort(); - } - - @Override - public void validateOutputPorts(final List<InvalidPortConnection> invalidPortConnections) { - // No code necessary - } - - @Override - protected void onSignal(final ISignal signal, final InputPort<?> inputPort) { - this.simplificator.onSignal(signal, inputPort); - } - - @Override - protected TerminationStrategy getTerminationStrategy() { - return this.simplificator.getTerminationStrategy(); - } - - @Override - protected void terminate() { - this.simplificator.terminate(); - } - - @Override - protected boolean shouldBeTerminated() { - return this.simplificator.shouldBeTerminated(); - } - - @Override - protected InputPort<?>[] getInputPorts() { - return this.simplificator.getInputPorts(); - } - - @Override - protected boolean isStarted() { - return this.collector.isStarted(); - } -} diff --git a/src/main/java/kieker/gui/mainview/Controller.java b/src/main/java/kieker/gui/mainview/Controller.java index d707d8ea..68fcb5ae 100644 --- a/src/main/java/kieker/gui/mainview/Controller.java +++ b/src/main/java/kieker/gui/mainview/Controller.java @@ -50,23 +50,21 @@ public final class Controller implements SelectionListener { this.propertiesModel = new PropertiesModel(); // Create the sub-controllers - final ISubController subViewController1 = new kieker.gui.subview.records.Controller(this.dataModel); - final ISubController subViewController2 = new kieker.gui.subview.aggregatedtraces.Controller(Filter.NONE, this.dataModel, this.propertiesModel); - final ISubController subViewController3 = new kieker.gui.subview.traces.Controller(Type.JUST_FAILED_TRACES, this.dataModel, this.propertiesModel); - final ISubController subViewController4 = new kieker.gui.subview.traces.Controller(Type.NONE, this.dataModel, this.propertiesModel); - final ISubController subViewController5 = new kieker.gui.subview.traces.Controller(Type.JUST_FAILURE_CONTAINING_TRACES, this.dataModel, this.propertiesModel); - final ISubController subViewController6 = new kieker.gui.subview.aggregatedtraces.Controller(Filter.JUST_FAILED_TRACES, this.dataModel, this.propertiesModel); - final ISubController subViewController7 = new kieker.gui.subview.aggregatedtraces.Controller(Filter.JUST_FAILURE_CONTAINING_TRACES, this.dataModel, this.propertiesModel); + final ISubController subViewController1 = new kieker.gui.subview.aggregatedtraces.Controller(Filter.NONE, this.dataModel, this.propertiesModel); + final ISubController subViewController2 = new kieker.gui.subview.traces.Controller(Type.JUST_FAILED_TRACES, this.dataModel, this.propertiesModel); + final ISubController subViewController3 = new kieker.gui.subview.traces.Controller(Type.NONE, this.dataModel, this.propertiesModel); + final ISubController subViewController4 = new kieker.gui.subview.traces.Controller(Type.JUST_FAILURE_CONTAINING_TRACES, this.dataModel, this.propertiesModel); + final ISubController subViewController5 = new kieker.gui.subview.aggregatedtraces.Controller(Filter.JUST_FAILED_TRACES, this.dataModel, this.propertiesModel); + final ISubController subViewController6 = new kieker.gui.subview.aggregatedtraces.Controller(Filter.JUST_FAILURE_CONTAINING_TRACES, this.dataModel, this.propertiesModel); // Get the sub-views from the controllers final Map<String, ISubView> subViews = new HashMap<>(); - subViews.put(SubView.RECORDS_SUB_VIEW.name(), subViewController1.getView()); - subViews.put(SubView.AGGREGATED_TRACES_SUB_VIEW.name(), subViewController2.getView()); - subViews.put(SubView.FAILED_TRACES_SUB_VIEW.name(), subViewController3.getView()); - subViews.put(SubView.TRACES_SUB_VIEW.name(), subViewController4.getView()); - subViews.put(SubView.FAILURE_CONTAINING_TRACES_SUB_VIEW.name(), subViewController5.getView()); - subViews.put(SubView.FAILED_AGGREGATED_TRACES_SUB_VIEW.name(), subViewController6.getView()); - subViews.put(SubView.FAILURE_CONTAINING_AGGREGATED_TRACES_SUB_VIEW.name(), subViewController7.getView()); + subViews.put(SubView.AGGREGATED_TRACES_SUB_VIEW.name(), subViewController1.getView()); + subViews.put(SubView.FAILED_TRACES_SUB_VIEW.name(), subViewController2.getView()); + subViews.put(SubView.TRACES_SUB_VIEW.name(), subViewController3.getView()); + subViews.put(SubView.FAILURE_CONTAINING_TRACES_SUB_VIEW.name(), subViewController4.getView()); + subViews.put(SubView.FAILED_AGGREGATED_TRACES_SUB_VIEW.name(), subViewController5.getView()); + subViews.put(SubView.FAILURE_CONTAINING_AGGREGATED_TRACES_SUB_VIEW.name(), subViewController6.getView()); // Create the main model and the main view this.mainViewModel = new Model(); @@ -123,9 +121,6 @@ public final class Controller implements SelectionListener { if (e.item == this.mainView.getTrtmExplorer()) { this.mainViewModel.setCurrentActiveSubView(SubView.NONE.name()); } - if (e.item == this.mainView.getTrtmRecords()) { - this.mainViewModel.setCurrentActiveSubView(SubView.RECORDS_SUB_VIEW.name()); - } if (e.item == this.mainView.getTrtmTraces()) { this.mainViewModel.setCurrentActiveSubView(SubView.TRACES_SUB_VIEW.name()); } @@ -152,7 +147,7 @@ public final class Controller implements SelectionListener { } public enum SubView { - RECORDS_SUB_VIEW, TRACES_SUB_VIEW, FAILED_TRACES_SUB_VIEW, AGGREGATED_TRACES_SUB_VIEW, NONE, FAILURE_CONTAINING_TRACES_SUB_VIEW, FAILED_AGGREGATED_TRACES_SUB_VIEW, FAILURE_CONTAINING_AGGREGATED_TRACES_SUB_VIEW + TRACES_SUB_VIEW, FAILED_TRACES_SUB_VIEW, AGGREGATED_TRACES_SUB_VIEW, NONE, FAILURE_CONTAINING_TRACES_SUB_VIEW, FAILED_AGGREGATED_TRACES_SUB_VIEW, FAILURE_CONTAINING_AGGREGATED_TRACES_SUB_VIEW } } diff --git a/src/main/java/kieker/gui/mainview/View.java b/src/main/java/kieker/gui/mainview/View.java index a4b583d2..4c089171 100644 --- a/src/main/java/kieker/gui/mainview/View.java +++ b/src/main/java/kieker/gui/mainview/View.java @@ -64,7 +64,6 @@ public final class View implements Observer { private Tree tree; private TreeItem trtmExplorer; - private TreeItem trtmRecords; private TreeItem trtmTraces; private TreeItem trtmAggregatedTraces; private TreeItem trtmJustFailedTraces; @@ -103,10 +102,6 @@ public final class View implements Observer { return this.trtmExplorer; } - public TreeItem getTrtmRecords() { - return this.trtmRecords; - } - public TreeItem getTrtmTraces() { return this.trtmTraces; } @@ -190,9 +185,6 @@ public final class View implements Observer { this.trtmExplorer = new TreeItem(this.tree, SWT.NONE); this.trtmExplorer.setText("Explorer"); - this.trtmRecords = new TreeItem(this.trtmExplorer, SWT.NONE); - this.trtmRecords.setText("Records"); - this.trtmTraces = new TreeItem(this.trtmExplorer, SWT.NONE); this.trtmTraces.setText("Traces"); diff --git a/src/main/java/kieker/gui/subview/records/Controller.java b/src/main/java/kieker/gui/subview/records/Controller.java deleted file mode 100644 index 811230bd..00000000 --- a/src/main/java/kieker/gui/subview/records/Controller.java +++ /dev/null @@ -1,60 +0,0 @@ -/*************************************************************************** - * Copyright 2014 Kieker Project (http://kieker-monitoring.net) - * - * 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 kieker.gui.subview.records; - -import java.util.List; - -import kieker.gui.common.domain.Record; -import kieker.gui.common.model.DataModel; -import kieker.gui.subview.ISubController; -import kieker.gui.subview.ISubView; -import kieker.gui.subview.util.AbstractDataModelProxy; -import kieker.gui.subview.util.IModel; - -/** - * The sub-controller responsible for the sub-view presenting the available records. - * - * @author Nils Christian Ehmke - */ -public final class Controller implements ISubController { - - private final ISubView view; - - public Controller(final DataModel dataModel) { - final IModel<Record> modelProxy = new RecordsModelProxy(dataModel); - - this.view = new View(modelProxy, this); - } - - @Override - public ISubView getView() { - return this.view; - } - - private final class RecordsModelProxy extends AbstractDataModelProxy<Record> { - - private RecordsModelProxy(final DataModel dataModel) { - super(dataModel); - } - - @Override - public List<Record> getContent() { - return super.dataModel.getRecordsCopy(); - } - } - -} diff --git a/src/main/java/kieker/gui/subview/records/View.java b/src/main/java/kieker/gui/subview/records/View.java deleted file mode 100644 index 59254f72..00000000 --- a/src/main/java/kieker/gui/subview/records/View.java +++ /dev/null @@ -1,160 +0,0 @@ -/*************************************************************************** - * Copyright 2014 Kieker Project (http://kieker-monitoring.net) - * - * 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 kieker.gui.subview.records; - -import java.util.List; -import java.util.Observable; -import java.util.Observer; - -import kieker.gui.common.domain.Record; -import kieker.gui.subview.ISubView; -import kieker.gui.subview.records.util.RecordTimestampComparator; -import kieker.gui.subview.records.util.RecordTypeComparator; -import kieker.gui.subview.util.IModel; -import kieker.gui.subview.util.TableColumnSortListener; - -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.TableItem; - -public final class View implements Observer, ISubView { - - private final IModel<Record> model; - private Composite composite; - private Table table; - private Label lblRecords; - private Composite statusBar; - - public View(final IModel<Record> model, final Controller controller) { - this.model = model; - - model.addObserver(this); - } - - /** - * @wbp.parser.entryPoint - */ - @Override - public void createComposite(final Composite parent) { - if (this.composite != null) { - this.composite.dispose(); - } - - this.composite = new Composite(parent, SWT.NONE); - final GridLayout gl_composite = new GridLayout(1, false); - gl_composite.verticalSpacing = 0; - gl_composite.marginHeight = 0; - gl_composite.marginWidth = 0; - gl_composite.horizontalSpacing = 0; - this.composite.setLayout(gl_composite); - - final TableViewer tableViewer = new TableViewer(this.composite, SWT.BORDER | SWT.FULL_SELECTION | SWT.VIRTUAL); - this.table = tableViewer.getTable(); - this.table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); - this.table.setHeaderVisible(true); - this.table.setLinesVisible(true); - - final TableColumn tblclmnTimestamp = new TableColumn(this.table, SWT.NONE); - tblclmnTimestamp.setWidth(100); - tblclmnTimestamp.setText("Timestamp"); - - final TableColumn tblclmnRecordType = new TableColumn(this.table, SWT.NONE); - tblclmnRecordType.setWidth(100); - tblclmnRecordType.setText("Record Type"); - - final TableColumn tblclmnRecordContent = new TableColumn(this.table, SWT.NONE); - tblclmnRecordContent.setWidth(100); - tblclmnRecordContent.setText("Record Content"); - - this.statusBar = new Composite(this.composite, SWT.NONE); - this.statusBar.setLayout(new GridLayout(1, false)); - - this.lblRecords = new Label(this.statusBar, SWT.NONE); - this.lblRecords.setText("0 Records"); - - this.table.addListener(SWT.SetData, new DataProvider()); - - tblclmnTimestamp.addSelectionListener(new TableColumnSortListener<>(new RecordTimestampComparator())); - tblclmnRecordType.addSelectionListener(new TableColumnSortListener<>(new RecordTypeComparator())); - tblclmnRecordContent.addSelectionListener(new TableColumnSortListener<>(new RecordTimestampComparator())); - } - - public Table getTable() { - return this.table; - } - - @Override - public Composite getComposite() { - return this.composite; - } - - @Override - public void update(final Observable observable, final Object obj) { - if (observable == this.model) { - this.updateTable(); - this.updateStatusBar(); - } - } - - private void updateStatusBar() { - this.lblRecords.setText(this.model.getContent().size() + " Record(s)"); - this.statusBar.getParent().layout(); - } - - private void updateTable() { - final List<Record> records = this.model.getContent(); - - this.table.setData(records); - this.table.setItemCount(records.size()); - this.table.clearAll(); - - for (final TableColumn column : this.table.getColumns()) { - column.pack(); - } - } - - private class DataProvider implements Listener { - - @Override - @SuppressWarnings("unchecked") - public void handleEvent(final Event event) { - // Get the necessary information from the event - final Table table = (Table) event.widget; - final TableItem item = (TableItem) event.item; - final int tableIndex = event.index; - - // Get the data for the current row - final List<Record> records = (List<Record>) table.getData(); - final Record record = records.get(tableIndex); - - // Get the data to display - final String timestampStr = Long.toString(record.getTimestamp()); - final String type = record.getType(); - final String recordStr = record.getRepresentation(); - item.setText(new String[] { timestampStr, type, recordStr }); - } - - } -} diff --git a/src/main/java/kieker/gui/subview/records/util/RecordTimestampComparator.java b/src/main/java/kieker/gui/subview/records/util/RecordTimestampComparator.java deleted file mode 100644 index 9427b38c..00000000 --- a/src/main/java/kieker/gui/subview/records/util/RecordTimestampComparator.java +++ /dev/null @@ -1,35 +0,0 @@ -/*************************************************************************** - * Copyright 2014 Kieker Project (http://kieker-monitoring.net) - * - * 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 kieker.gui.subview.records.util; - -import kieker.gui.common.domain.Record; -import kieker.gui.subview.util.AbstractDirectedComparator; - -import org.eclipse.swt.SWT; - -public class RecordTimestampComparator extends AbstractDirectedComparator<Record> { - - @Override - public int compare(final Record o1, final Record o2) { - int result = Long.compare(o1.getTimestamp(), o2.getTimestamp()); - if (this.getDirection() == SWT.UP) { - result = -result; - } - return result; - } - -} diff --git a/src/main/java/kieker/gui/subview/records/util/RecordTypeComparator.java b/src/main/java/kieker/gui/subview/records/util/RecordTypeComparator.java deleted file mode 100644 index 8c9b5c15..00000000 --- a/src/main/java/kieker/gui/subview/records/util/RecordTypeComparator.java +++ /dev/null @@ -1,35 +0,0 @@ -/*************************************************************************** - * Copyright 2014 Kieker Project (http://kieker-monitoring.net) - * - * 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 kieker.gui.subview.records.util; - -import kieker.gui.common.domain.Record; -import kieker.gui.subview.util.AbstractDirectedComparator; - -import org.eclipse.swt.SWT; - -public class RecordTypeComparator extends AbstractDirectedComparator<Record> { - - @Override - public int compare(final Record o1, final Record o2) { - int result = o1.getType().compareTo(o2.getType()); - if (this.getDirection() == SWT.UP) { - result = -result; - } - return result; - } - -} diff --git a/src/test/java/kieker/gui/common/model/importer/stages/RecordSimplificatorTest.java b/src/test/java/kieker/gui/common/model/importer/stages/RecordSimplificatorTest.java deleted file mode 100644 index 16816888..00000000 --- a/src/test/java/kieker/gui/common/model/importer/stages/RecordSimplificatorTest.java +++ /dev/null @@ -1,51 +0,0 @@ -package kieker.gui.common.model.importer.stages; - -import static org.hamcrest.Matchers.hasSize; -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; - -import java.util.ArrayList; -import java.util.List; - -import kieker.common.record.flow.trace.operation.BeforeOperationEvent; -import kieker.gui.common.domain.Record; -import kieker.gui.common.model.importer.stages.RecordSimplificator; - -import org.junit.Before; -import org.junit.Test; - -import teetime.framework.pipe.IPipeFactory; -import teetime.framework.pipe.SingleElementPipeFactory; -import teetime.stage.CollectorSink; - -public class RecordSimplificatorTest { - - private List<Record> recordCollectorList; - private RecordSimplificator simplificatorUnderTest; - private CollectorSink<Record> recordCollector; - - @Before - public void initializeRecordSimplificator() { - this.recordCollectorList = new ArrayList<>(); - - this.simplificatorUnderTest = new RecordSimplificator(); - this.recordCollector = new CollectorSink<>(this.recordCollectorList); - - final IPipeFactory pipeFactory = new SingleElementPipeFactory(); - pipeFactory.create(this.simplificatorUnderTest.getOutputPort(), this.recordCollector.getInputPort()); - } - - @Test - public void simplificationShouldPreserveContent() { - final BeforeOperationEvent record = new BeforeOperationEvent(1, 2, 3, "Bookstore()", "Bookstore"); - this.simplificatorUnderTest.execute(record); - - assertThat(this.recordCollectorList, hasSize(1)); - - final Record simplifiedRecord = this.recordCollectorList.get(0); - assertThat(simplifiedRecord.getType(), is(record.getClass().getCanonicalName())); - assertThat(simplifiedRecord.getRepresentation(), is(record.toString())); - assertThat(simplifiedRecord.getTimestamp(), is(record.getLoggingTimestamp())); - } - -} -- GitLab