Issue #1420 - Additional changes and cleanup
Issue #1420 - remove commented out code, move method Issue #1420 - fix for max latency Change-Id: I8a983812e4fab7477659d7f175eaa005bb92f064 Former-commit-id:8411a46e3e
[formerly279729e88e
[formerly d69e77e9b902d164a5716e432f62bd99e1b784dd]] Former-commit-id:279729e88e
Former-commit-id:329a010b07
This commit is contained in:
parent
0c51e2e3aa
commit
0eb256fc41
17 changed files with 344 additions and 141 deletions
|
@ -143,7 +143,8 @@ public class PriorityComp extends Composite {
|
|||
latencyText = new Text(latencyComp, SWT.BORDER);
|
||||
latencyText.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true,
|
||||
false));
|
||||
latencyText.setToolTipText("Subscription Latency in Minutes");
|
||||
latencyText
|
||||
.setToolTipText("Time in minutes allotted for a subscription to download");
|
||||
latencyText.setText(String.valueOf(this.latency));
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
package com.raytheon.uf.viz.datadelivery.common.ui;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.DisposeEvent;
|
||||
|
@ -60,7 +61,8 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public abstract class TableComp extends Composite implements INotificationObserver {
|
||||
public abstract class TableComp extends Composite implements
|
||||
INotificationObserver {
|
||||
|
||||
/** Data table. */
|
||||
protected Table table;
|
||||
|
@ -100,7 +102,8 @@ public abstract class TableComp extends Composite implements INotificationObserv
|
|||
* Flag indicating if an observer should be added to the
|
||||
* Notification manager.
|
||||
*/
|
||||
public TableComp(Composite parent, TableCompConfig tableConfig, boolean notifObserverFlag) {
|
||||
public TableComp(Composite parent, TableCompConfig tableConfig,
|
||||
boolean notifObserverFlag) {
|
||||
super(parent, SWT.NONE);
|
||||
this.parentComp = parent;
|
||||
this.tableConfig = tableConfig;
|
||||
|
@ -203,14 +206,16 @@ public abstract class TableComp extends Composite implements INotificationObserv
|
|||
}
|
||||
|
||||
if (table.getItemCount() > 0) {
|
||||
//Only change image if table is re-opened
|
||||
// Only change image if table is re-opened
|
||||
if (!configChange) {
|
||||
sortedColumn.setImage(sortImages.getImage(sortDir));
|
||||
} else if (sortDir == SortDirection.ASCENDING) {
|
||||
sortedColumn.setImage(sortImages.getImage(SortDirection.ASCENDING));
|
||||
sortedColumn.setImage(sortImages
|
||||
.getImage(SortDirection.ASCENDING));
|
||||
} else {
|
||||
sortedColumn.setImage(sortImages.getImage(SortDirection.DESCENDING));
|
||||
}
|
||||
sortedColumn.setImage(sortImages
|
||||
.getImage(SortDirection.DESCENDING));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -225,13 +230,13 @@ public abstract class TableComp extends Composite implements INotificationObserv
|
|||
*/
|
||||
public final void showColumnToolTips(boolean show) {
|
||||
if (show) {
|
||||
HashMap<String, String> toolTipsMap = DataDeliveryUtils.getColumnToolTipsMap(tableConfig.getTableType());
|
||||
Map<String, String> toolTipsMap = DataDeliveryUtils
|
||||
.getColumnToolTipsMap(tableConfig.getTableType());
|
||||
|
||||
for (TableColumn tc : table.getColumns()) {
|
||||
tc.setToolTipText(toolTipsMap.get(tc.getText()));
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
for (TableColumn tc : table.getColumns()) {
|
||||
tc.setToolTipText(null);
|
||||
}
|
||||
|
@ -248,21 +253,23 @@ public abstract class TableComp extends Composite implements INotificationObserv
|
|||
* @param clickSort
|
||||
* Only change column sort direction on click
|
||||
*/
|
||||
public void updateSortDirection(TableColumn tc, ISortTable tableData, boolean clickSort) {
|
||||
public void updateSortDirection(TableColumn tc, ISortTable tableData,
|
||||
boolean clickSort) {
|
||||
|
||||
if (!configChange) {
|
||||
SortDirection sortDirection = SortDirection.ASCENDING;
|
||||
|
||||
if (sortedColumn != null && tc.getText().equals(sortedColumn.getText())) {
|
||||
if (sortedColumn != null
|
||||
&& tc.getText().equals(sortedColumn.getText())) {
|
||||
|
||||
if (sortDirectionMap.containsKey(sortedColumn.getText())) {
|
||||
sortDirection = sortDirectionMap.get(sortedColumn.getText());
|
||||
sortDirection = sortDirectionMap
|
||||
.get(sortedColumn.getText());
|
||||
|
||||
if (clickSort) {
|
||||
if (sortDirection == SortDirection.DESCENDING) {
|
||||
sortDirection = SortDirection.ASCENDING;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
sortDirection = SortDirection.DESCENDING;
|
||||
}
|
||||
}
|
||||
|
@ -271,12 +278,11 @@ public abstract class TableComp extends Composite implements INotificationObserv
|
|||
|
||||
sortDirectionMap.put(sortedColumn.getText(), sortDirection);
|
||||
tableData.setSortDirection(sortDirection);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (sortDirectionMap.containsKey(tc.getText())) {
|
||||
tableData.setSortDirection(sortDirectionMap.get(tc.getText()));
|
||||
}
|
||||
else {
|
||||
tableData.setSortDirection(sortDirectionMap.get(tc
|
||||
.getText()));
|
||||
} else {
|
||||
sortDirectionMap.put(sortedColumn.getText(), sortDirection);
|
||||
tableData.setSortDirection(sortDirection);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ package com.raytheon.uf.viz.datadelivery.subscription.presenter;
|
|||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
@ -68,6 +67,7 @@ import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionService;
|
|||
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionService.ISubscriptionServiceResult;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.view.ICreateSubscriptionDlgView;
|
||||
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryGUIUtils;
|
||||
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
|
||||
import com.raytheon.viz.ui.presenter.components.ButtonConf;
|
||||
import com.raytheon.viz.ui.presenter.components.CheckBoxConf;
|
||||
import com.raytheon.viz.ui.presenter.components.ComboBoxConf;
|
||||
|
@ -305,6 +305,9 @@ public class CreateSubscriptionDlgPresenter {
|
|||
populate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate the dialog.
|
||||
*/
|
||||
private void populate() {
|
||||
if (this.subscription == null) {
|
||||
return;
|
||||
|
@ -751,7 +754,7 @@ public class CreateSubscriptionDlgPresenter {
|
|||
// Validate the date entries
|
||||
datesValid = this.durationValidChk();
|
||||
activeDatesValid = this.activePeriodValidChk();
|
||||
int maxLatency = getMaxLatency();
|
||||
int maxLatency = DataDeliveryUtils.getMaxLatency(subscription);
|
||||
latencyValid = DataDeliveryGUIUtils.latencyValidChk(
|
||||
view.getLatencyValue(), maxLatency);
|
||||
if (!latencyValid) {
|
||||
|
@ -1003,27 +1006,6 @@ public class CreateSubscriptionDlgPresenter {
|
|||
return datesValid && dateOrderValid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the max latency allowed.
|
||||
*
|
||||
* @return The max latency value allowed
|
||||
*/
|
||||
private int getMaxLatency() {
|
||||
List<Integer> cycles = dataSet.getTime().getCycleTimes();
|
||||
Collections.sort(cycles);
|
||||
int max = 0;
|
||||
|
||||
for (int i = 0; i < cycles.size(); i++) {
|
||||
if (i + 1 <= cycles.size()) {
|
||||
int tempMax = cycles.get(i + 1) - cycles.get(i);
|
||||
if (tempMax > max) {
|
||||
max = tempMax;
|
||||
}
|
||||
}
|
||||
}
|
||||
return max;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the registry id to the subscription object.
|
||||
*/
|
||||
|
|
|
@ -25,7 +25,7 @@ import javax.xml.bind.annotation.XmlElement;
|
|||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Priority rule xml object.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
|
|
@ -32,7 +32,7 @@ import com.raytheon.uf.common.status.UFStatus;
|
|||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.datadelivery.system.Operator;
|
||||
import com.raytheon.uf.viz.datadelivery.system.OpsNetFieldNames;
|
||||
import com.raytheon.uf.viz.datadelivery.utils.DataSizeUtil;
|
||||
import com.raytheon.uf.viz.datadelivery.utils.DataSizeUnit;
|
||||
|
||||
/**
|
||||
* Parent Rules xml class
|
||||
|
@ -220,13 +220,9 @@ public abstract class RuleXML {
|
|||
if (OpsNetFieldNames.SIZE.toString().equals(ruleField)) {
|
||||
long dsSizeKb = sub.getDataSetSize(); // Size in KB
|
||||
long ruleValueInt = Integer.parseInt(ruleValue);
|
||||
DataSizeUnit dsUnit = DataSizeUnit.valueOf(unit);
|
||||
ruleValueInt = dsUnit.toKB(ruleValueInt);
|
||||
|
||||
if (unit.equals(DataSizeUtil.MB.getUnit())) {
|
||||
ruleValueInt = DataSizeUtil.MB.toKB(ruleValueInt);
|
||||
} else if (unit.equals(DataSizeUtil.GB.getUnit())) {
|
||||
ruleValueInt = DataSizeUtil.GB.toKB(ruleValueInt);
|
||||
}
|
||||
System.out.println(dsSizeKb + " == " + ruleValueInt);
|
||||
return oper.evaluate(Long.valueOf(dsSizeKb),
|
||||
Long.valueOf(ruleValueInt));
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ import com.raytheon.uf.viz.datadelivery.subscription.xml.RuleXML;
|
|||
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryGUIUtils;
|
||||
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryGUIUtils.SubscriptionPriority;
|
||||
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
|
||||
import com.raytheon.uf.viz.datadelivery.utils.DataSizeUtil;
|
||||
import com.raytheon.uf.viz.datadelivery.utils.DataSizeUnit;
|
||||
import com.raytheon.uf.viz.datadelivery.utils.NameOperationItems;
|
||||
import com.raytheon.uf.viz.datadelivery.utils.TypeOperationItems;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
|
@ -704,6 +704,7 @@ public class CreateEditRuleDlg extends CaveSWTDialog {
|
|||
if (frequencyFlag || sizeFlag) {
|
||||
unit = unitsCombo.getItem(unitsCombo.getSelectionIndex());
|
||||
}
|
||||
|
||||
boolean saved = false;
|
||||
|
||||
if (PRIORITY_TYPE.equals(ruleType)) {
|
||||
|
@ -784,8 +785,8 @@ public class CreateEditRuleDlg extends CaveSWTDialog {
|
|||
|
||||
private void createSizeUnitItems() {
|
||||
unitsCombo.removeAll();
|
||||
DataSizeUtil[] sizeUnits = DataSizeUtil.values();
|
||||
for (DataSizeUtil suo : sizeUnits) {
|
||||
DataSizeUnit[] sizeUnits = DataSizeUnit.values();
|
||||
for (DataSizeUnit suo : sizeUnits) {
|
||||
unitsCombo.add(suo.getUnit());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
package com.raytheon.uf.viz.datadelivery.system;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Operator interface.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
|
|
@ -212,11 +212,20 @@ public class SystemLatencyTab {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable the buttons?
|
||||
*
|
||||
* @param enable
|
||||
* setting for the buttons
|
||||
*/
|
||||
private void enableButtons(boolean enable) {
|
||||
deleteBtn.setEnabled(enable);
|
||||
editBtn.setEnabled(enable);
|
||||
}
|
||||
|
||||
/**
|
||||
* New/Edit latency rule action handler.
|
||||
*/
|
||||
private void handleLatencyRule() {
|
||||
final DataDeliveryPermission permission = DataDeliveryPermission.SYSTEM_MANAGEMENT_CREATE;
|
||||
IUser user = UserController.getUserObject();
|
||||
|
@ -268,6 +277,9 @@ public class SystemLatencyTab {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete rule action handler.
|
||||
*/
|
||||
private void handleDeleteRule() {
|
||||
final DataDeliveryPermission permission = DataDeliveryPermission.SYSTEM_MANAGEMENT_CREATE;
|
||||
IUser user = UserController.getUserObject();
|
||||
|
|
|
@ -218,6 +218,12 @@ public class SystemPriorityTab {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* enable/disable the delete and edit buttons
|
||||
*
|
||||
* @param enable
|
||||
* setting for buttons
|
||||
*/
|
||||
private void enableButtons(boolean enable) {
|
||||
deleteBtn.setEnabled(enable);
|
||||
editBtn.setEnabled(enable);
|
||||
|
@ -277,6 +283,9 @@ public class SystemPriorityTab {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete action handler.
|
||||
*/
|
||||
private void handleDeleteRule() {
|
||||
final DataDeliveryPermission permission = DataDeliveryPermission.SYSTEM_MANAGEMENT_CREATE;
|
||||
IUser user = UserController.getUserObject();
|
||||
|
|
|
@ -79,8 +79,10 @@ public class SystemRuleManager {
|
|||
private final String RULE_PATH = "datadelivery" + File.separator
|
||||
+ "systemManagement" + File.separator + "rules" + File.separator;
|
||||
|
||||
/** Latency rule file */
|
||||
private final String LATENCY_RULE_FILE = RULE_PATH + "latencyRules.xml";
|
||||
|
||||
/** Priority rule file */
|
||||
private final String PRIORITY_RULE_FILE = RULE_PATH + "priorityRules.xml";
|
||||
|
||||
/** Status Handler */
|
||||
|
@ -96,6 +98,7 @@ public class SystemRuleManager {
|
|||
/** Unmarshaller object */
|
||||
private Unmarshaller unmarshaller;
|
||||
|
||||
/** Bandwidth service */
|
||||
private IBandwidthService bandwidthService;
|
||||
|
||||
/**
|
||||
|
@ -144,6 +147,13 @@ public class SystemRuleManager {
|
|||
return getPriorityRules().getRuleNames();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the priority rule.
|
||||
*
|
||||
* @param name
|
||||
* the name of the rule
|
||||
* @return the PriorityRuleXML object
|
||||
*/
|
||||
public PriorityRuleXML loadPriorityRule(String name) {
|
||||
PriorityRulesXML priorityRules = getPriorityRules();
|
||||
for (PriorityRuleXML rule : priorityRules.getRules()) {
|
||||
|
@ -155,6 +165,13 @@ public class SystemRuleManager {
|
|||
return new PriorityRuleXML();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the latency rule.
|
||||
*
|
||||
* @param name
|
||||
* the name of the rule
|
||||
* @return the LatencyRuleXML object
|
||||
*/
|
||||
public LatencyRuleXML loadLatencyRule(String name) {
|
||||
LatencyRulesXML latencyRules = getLatencyRules();
|
||||
for (LatencyRuleXML rule : latencyRules.getRules()) {
|
||||
|
@ -176,6 +193,13 @@ public class SystemRuleManager {
|
|||
return getLatencyRules().getRuleNames();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save priority rules.
|
||||
*
|
||||
* @param xmlObj
|
||||
* the rules to save
|
||||
* @return true if saved successful
|
||||
*/
|
||||
public boolean savePriorityRules(PriorityRulesXML xmlObj) {
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
|
||||
|
@ -197,6 +221,13 @@ public class SystemRuleManager {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save latency rules.
|
||||
*
|
||||
* @param xmlObj
|
||||
* the rules to save
|
||||
* @return true if saved successful
|
||||
*/
|
||||
public boolean saveLatencyRules(LatencyRulesXML xmlObj) {
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
|
||||
|
@ -218,6 +249,12 @@ public class SystemRuleManager {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the latency rule.
|
||||
*
|
||||
* @param ruleName
|
||||
* the rule name to delete
|
||||
*/
|
||||
public void deleteLatencyRule(String ruleName) {
|
||||
LatencyRulesXML latencyRules = getLatencyRules();
|
||||
|
||||
|
@ -230,6 +267,12 @@ public class SystemRuleManager {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the priority rule.
|
||||
*
|
||||
* @param ruleName
|
||||
* the rule name to delete
|
||||
*/
|
||||
public void deletePriorityRule(String ruleName) {
|
||||
PriorityRulesXML priorityRules = getPriorityRules();
|
||||
|
||||
|
@ -242,6 +285,13 @@ public class SystemRuleManager {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the rule.
|
||||
*
|
||||
* @param rule
|
||||
* The rule to update
|
||||
* @return true if updated
|
||||
*/
|
||||
public boolean updateRule(LatencyRuleXML rule) {
|
||||
LatencyRulesXML rulesXml = getLatencyRules();
|
||||
boolean saved = rulesXml.updateRule(rule);
|
||||
|
@ -252,6 +302,13 @@ public class SystemRuleManager {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the rule.
|
||||
*
|
||||
* @param rule
|
||||
* The rule to update
|
||||
* @return true if updated
|
||||
*/
|
||||
public boolean updateRule(PriorityRuleXML rule) {
|
||||
PriorityRulesXML rulesXml = getPriorityRules();
|
||||
boolean saved = rulesXml.updateRule(rule);
|
||||
|
@ -266,6 +323,13 @@ public class SystemRuleManager {
|
|||
return saved;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the rule.
|
||||
*
|
||||
* @param rule
|
||||
* The rule to update
|
||||
* @return true if updated
|
||||
*/
|
||||
public boolean saveRule(PriorityRuleXML rule) {
|
||||
PriorityRulesXML rulesXml = getPriorityRules();
|
||||
boolean saved = rulesXml.addRule(rule);
|
||||
|
@ -280,6 +344,13 @@ public class SystemRuleManager {
|
|||
return saved;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the rule.
|
||||
*
|
||||
* @param rule
|
||||
* The rule to update
|
||||
* @return true if updated
|
||||
*/
|
||||
public boolean saveRule(LatencyRuleXML rule) {
|
||||
LatencyRulesXML rulesXml = getLatencyRules();
|
||||
boolean saved = rulesXml.addRule(rule);
|
||||
|
@ -294,6 +365,11 @@ public class SystemRuleManager {
|
|||
return saved;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the latency rules.
|
||||
*
|
||||
* @return The latency rules xml object
|
||||
*/
|
||||
private LatencyRulesXML getLatencyRules() {
|
||||
LocalizationFile lfile = getRules(this.LATENCY_RULE_FILE);
|
||||
|
||||
|
@ -311,6 +387,11 @@ public class SystemRuleManager {
|
|||
return latencyRules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the priority rules
|
||||
*
|
||||
* @return The priority rules xml object
|
||||
*/
|
||||
private PriorityRulesXML getPriorityRules() {
|
||||
LocalizationFile lfile = getRules(this.PRIORITY_RULE_FILE);
|
||||
|
||||
|
@ -327,33 +408,18 @@ public class SystemRuleManager {
|
|||
return priorityRules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the rules files
|
||||
*
|
||||
* @param name
|
||||
* Rules file name to get
|
||||
* @return The localization file
|
||||
*/
|
||||
private LocalizationFile getRules(String name) {
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
return pm.getStaticLocalizationFile(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default latency.
|
||||
*
|
||||
* @param DataSetFrequency
|
||||
* Frequency of the data
|
||||
*
|
||||
* @return The default latency
|
||||
*/
|
||||
public int getDefaultLatency(DataSetFrequency freq) {
|
||||
int frequency = 40;
|
||||
switch (freq) {
|
||||
case HOURLY:
|
||||
frequency = 40;
|
||||
break;
|
||||
case SIX_HOURLY:
|
||||
frequency = 115;
|
||||
break;
|
||||
}
|
||||
|
||||
return frequency;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default latency value given the cycleTimes.
|
||||
*
|
||||
|
@ -363,7 +429,7 @@ public class SystemRuleManager {
|
|||
public int getDefaultLatency(List<Integer> cycleTimes) {
|
||||
DataSetFrequency freq = DataSetFrequency.fromCycleTimes(cycleTimes);
|
||||
|
||||
return getDefaultLatency(freq);
|
||||
return freq.getDefaultLatency();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -21,8 +21,10 @@ package com.raytheon.uf.viz.datadelivery.utils;
|
|||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.widgets.MessageBox;
|
||||
|
@ -33,7 +35,11 @@ import com.raytheon.uf.common.datadelivery.registry.DataLevelType;
|
|||
import com.raytheon.uf.common.datadelivery.registry.Parameter;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Time;
|
||||
import com.raytheon.uf.common.datadelivery.request.DataDeliveryAuthRequest;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
import com.raytheon.uf.common.util.CollectionUtil;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
|
||||
/**
|
||||
|
@ -53,6 +59,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* Oct 31, 2012 1278 mpduff Moved spatial methods to SpatialUtils.
|
||||
* Nov 20, 2012 1286 djohnson Add showYesNoMessage.
|
||||
* Dec 20, 2012 1413 bgonzale Added PendingSubColumnNames.valueOfColumnName(String).
|
||||
* Jan 10, 2013 1420 mdpuff Added getMaxLatency().
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
|
@ -112,7 +119,7 @@ public class DataDeliveryUtils {
|
|||
|
||||
/**
|
||||
* Get column name.
|
||||
*
|
||||
*
|
||||
* @return Column Name
|
||||
*/
|
||||
public String getColumnName() {
|
||||
|
@ -121,7 +128,7 @@ public class DataDeliveryUtils {
|
|||
|
||||
/**
|
||||
* Get the tool tip
|
||||
*
|
||||
*
|
||||
* @return The tool tip.
|
||||
*/
|
||||
public String getToolTip() {
|
||||
|
@ -179,7 +186,7 @@ public class DataDeliveryUtils {
|
|||
|
||||
/**
|
||||
* Get column name.
|
||||
*
|
||||
*
|
||||
* @return Column Name
|
||||
*/
|
||||
public String getColumnName() {
|
||||
|
@ -188,7 +195,7 @@ public class DataDeliveryUtils {
|
|||
|
||||
/**
|
||||
* Get the tool tip
|
||||
*
|
||||
*
|
||||
* @return The tool tip.
|
||||
*/
|
||||
public String getToolTip() {
|
||||
|
@ -225,7 +232,7 @@ public class DataDeliveryUtils {
|
|||
|
||||
/**
|
||||
* Get column name.
|
||||
*
|
||||
*
|
||||
* @return Column Name
|
||||
*/
|
||||
public String getColumnName() {
|
||||
|
@ -234,7 +241,7 @@ public class DataDeliveryUtils {
|
|||
|
||||
/**
|
||||
* Get the tool tip
|
||||
*
|
||||
*
|
||||
* @return The tool tip.
|
||||
*/
|
||||
public String getToolTip() {
|
||||
|
@ -269,7 +276,7 @@ public class DataDeliveryUtils {
|
|||
|
||||
/**
|
||||
* Get column name.
|
||||
*
|
||||
*
|
||||
* @return Column Name
|
||||
*/
|
||||
public String getColumnName() {
|
||||
|
@ -278,7 +285,7 @@ public class DataDeliveryUtils {
|
|||
|
||||
/**
|
||||
* Get the tool tip
|
||||
*
|
||||
*
|
||||
* @return The tool tip.
|
||||
*/
|
||||
public String getToolTip() {
|
||||
|
@ -341,13 +348,12 @@ public class DataDeliveryUtils {
|
|||
|
||||
/**
|
||||
* Get the column tool tips.
|
||||
*
|
||||
*
|
||||
* @param tableType
|
||||
* Table type.
|
||||
* @return String array of tool tips.
|
||||
*/
|
||||
public static HashMap<String, String> getColumnToolTipsMap(
|
||||
TABLE_TYPE tableType) {
|
||||
public static Map<String, String> getColumnToolTipsMap(TABLE_TYPE tableType) {
|
||||
HashMap<String, String> toolTipMap = new HashMap<String, String>();
|
||||
|
||||
if (tableType == TABLE_TYPE.SUBSCRIPTION) {
|
||||
|
@ -374,7 +380,7 @@ public class DataDeliveryUtils {
|
|||
|
||||
/**
|
||||
* Show a MessageBox.
|
||||
*
|
||||
*
|
||||
* @param shell
|
||||
* The parent shell
|
||||
* @param style
|
||||
|
@ -409,10 +415,10 @@ public class DataDeliveryUtils {
|
|||
|
||||
/**
|
||||
* Provides the text for the subscription details dialog
|
||||
*
|
||||
*
|
||||
* @param sub
|
||||
* The subscription object
|
||||
*
|
||||
*
|
||||
* @return The formated details string
|
||||
*/
|
||||
public static String formatDetails(Subscription sub) {
|
||||
|
@ -521,4 +527,41 @@ public class DataDeliveryUtils {
|
|||
return fmtStr.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an authorization request
|
||||
*
|
||||
* @param request
|
||||
* The request object
|
||||
* @return DataDeliveryAuthReqeust object
|
||||
* @throws VizException
|
||||
*/
|
||||
public static DataDeliveryAuthRequest sendAuthorizationRequest(
|
||||
DataDeliveryAuthRequest request) throws VizException {
|
||||
return (DataDeliveryAuthRequest) ThriftClient
|
||||
.sendPrivilegedRequest(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the maximum latency for the provided subscription. Calculated as the
|
||||
* maximum cyclic difference.
|
||||
*
|
||||
* @param subscription
|
||||
* The subscription
|
||||
* @return the maximum latency in minutes
|
||||
*/
|
||||
public static int getMaxLatency(Subscription subscription) {
|
||||
List<Integer> cycles = subscription.getTime().getCycleTimes();
|
||||
Collections.sort(cycles);
|
||||
int max = TimeUtil.HOURS_PER_DAY * TimeUtil.MINUTES_PER_HOUR;
|
||||
|
||||
for (int i = 0; i < cycles.size(); i++) {
|
||||
if (i + 1 <= cycles.size()) {
|
||||
int tempMax = cycles.get(i + 1) - cycles.get(i);
|
||||
if (tempMax > max) {
|
||||
max = tempMax;
|
||||
}
|
||||
}
|
||||
}
|
||||
return max;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,21 +39,30 @@ import java.util.List;
|
|||
*/
|
||||
|
||||
public enum DataSetFrequency {
|
||||
HOURLY, SIX_HOURLY;
|
||||
HOURLY(40), SIX_HOURLY(115), TWELVE_HOURLY(115), DAILY(115);
|
||||
|
||||
private DataSetFrequency() {
|
||||
private int defaultLatency;
|
||||
|
||||
private DataSetFrequency(int defaultLatency) {
|
||||
this.defaultLatency = defaultLatency;
|
||||
}
|
||||
|
||||
public static DataSetFrequency fromCycleTimes(List<Integer> cycleTimes) {
|
||||
if (cycleTimes.size() > 1) {
|
||||
if ((cycleTimes.get(1) - cycleTimes.get(0)) == 1) {
|
||||
return DataSetFrequency.HOURLY;
|
||||
} else {
|
||||
} else if ((cycleTimes.get(1) - cycleTimes.get(0)) == 6) {
|
||||
return DataSetFrequency.SIX_HOURLY;
|
||||
} else if ((cycleTimes.get(1) - cycleTimes.get(0)) == 12) {
|
||||
return DataSetFrequency.TWELVE_HOURLY;
|
||||
} else if ((cycleTimes.get(1) - cycleTimes.get(0)) == 24) {
|
||||
return DataSetFrequency.DAILY;
|
||||
}
|
||||
}
|
||||
return DataSetFrequency.DAILY;
|
||||
}
|
||||
|
||||
return DataSetFrequency.SIX_HOURLY;
|
||||
public int getDefaultLatency() {
|
||||
return this.defaultLatency;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
package com.raytheon.uf.viz.datadelivery.utils;
|
||||
|
||||
import javax.xml.bind.annotation.XmlEnum;
|
||||
import javax.xml.bind.annotation.XmlEnumValue;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
/**
|
||||
* Enumeration for Data Size units and conversions.
|
||||
* Enumeration for Data Size units and conversions. Based off of TimeUnit class.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -16,7 +20,10 @@ package com.raytheon.uf.viz.datadelivery.utils;
|
|||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
public enum DataSizeUtil {
|
||||
@XmlType(name = "ruleUnit")
|
||||
@XmlEnum
|
||||
public enum DataSizeUnit {
|
||||
@XmlEnumValue("Byte")
|
||||
BYTE("Byte") {
|
||||
@Override
|
||||
public long toByte(long l) {
|
||||
|
@ -39,10 +46,11 @@ public enum DataSizeUtil {
|
|||
}
|
||||
|
||||
@Override
|
||||
public long convert(long l, DataSizeUtil ds) {
|
||||
public long convert(long l, DataSizeUnit ds) {
|
||||
return ds.toByte(l);
|
||||
}
|
||||
},
|
||||
@XmlEnumValue("KB")
|
||||
KB("KB") {
|
||||
@Override
|
||||
public long toByte(long l) {
|
||||
|
@ -65,10 +73,11 @@ public enum DataSizeUtil {
|
|||
}
|
||||
|
||||
@Override
|
||||
public long convert(long l, DataSizeUtil ds) {
|
||||
public long convert(long l, DataSizeUnit ds) {
|
||||
return ds.toKB(l);
|
||||
}
|
||||
},
|
||||
@XmlEnumValue("MB")
|
||||
MB("MB") {
|
||||
@Override
|
||||
public long toByte(long l) {
|
||||
|
@ -91,10 +100,11 @@ public enum DataSizeUtil {
|
|||
}
|
||||
|
||||
@Override
|
||||
public long convert(long l, DataSizeUtil ds) {
|
||||
public long convert(long l, DataSizeUnit ds) {
|
||||
return ds.toMB(l);
|
||||
}
|
||||
},
|
||||
@XmlEnumValue("GB")
|
||||
GB("GB") {
|
||||
@Override
|
||||
public long toByte(long l) {
|
||||
|
@ -117,7 +127,7 @@ public enum DataSizeUtil {
|
|||
}
|
||||
|
||||
@Override
|
||||
public long convert(long l, DataSizeUtil ds) {
|
||||
public long convert(long l, DataSizeUnit ds) {
|
||||
return ds.toGB(l);
|
||||
}
|
||||
};
|
||||
|
@ -127,7 +137,7 @@ public enum DataSizeUtil {
|
|||
/** String unit */
|
||||
private String unit;
|
||||
|
||||
private DataSizeUtil(String unit) {
|
||||
private DataSizeUnit(String unit) {
|
||||
this.unit = unit;
|
||||
}
|
||||
|
||||
|
@ -190,5 +200,5 @@ public enum DataSizeUtil {
|
|||
*
|
||||
* @return converted value
|
||||
*/
|
||||
public abstract long convert(long l, DataSizeUtil ds);
|
||||
public abstract long convert(long l, DataSizeUnit ds);
|
||||
}
|
|
@ -1,3 +1,22 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.datadelivery.utils;
|
||||
|
||||
import javax.xml.bind.annotation.XmlEnum;
|
||||
|
@ -6,6 +25,23 @@ import javax.xml.bind.annotation.XmlType;
|
|||
|
||||
import com.raytheon.uf.viz.datadelivery.system.Operator;
|
||||
|
||||
/**
|
||||
* Name Operation Enum.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 8, 2013 1420 mpduff Initial creation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
/** Enumeration to use for Dataset Name operations */
|
||||
@XmlType(name = "nameOperationItems")
|
||||
@XmlEnum
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.datadelivery.utils;
|
||||
|
||||
import javax.xml.bind.annotation.XmlEnum;
|
||||
|
@ -6,7 +25,22 @@ import javax.xml.bind.annotation.XmlType;
|
|||
|
||||
import com.raytheon.uf.viz.datadelivery.system.Operator;
|
||||
|
||||
/** Enumeration to use for Datatype operations */
|
||||
/**
|
||||
* Data Type Operation Enum.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 8, 2013 1420 mpduff Initial creation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
@XmlType(name = "typeOperationItems")
|
||||
@XmlEnum
|
||||
public enum TypeOperationItems implements Operator<String> {
|
||||
|
|
|
@ -33,7 +33,7 @@ import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
|||
import com.raytheon.uf.viz.datadelivery.system.CreateEditRuleDlg.FreqUnitOptions;
|
||||
import com.raytheon.uf.viz.datadelivery.system.OperatorTypes;
|
||||
import com.raytheon.uf.viz.datadelivery.system.OpsNetFieldNames;
|
||||
import com.raytheon.uf.viz.datadelivery.utils.DataSizeUtil;
|
||||
import com.raytheon.uf.viz.datadelivery.utils.DataSizeUnit;
|
||||
import com.raytheon.uf.viz.datadelivery.utils.NameOperationItems;
|
||||
import com.raytheon.uf.viz.datadelivery.utils.TypeOperationItems;
|
||||
|
||||
|
@ -112,7 +112,7 @@ public class RuleXMLTest {
|
|||
rule.setRuleValue(String.valueOf(100));
|
||||
rule.setRuleField(OpsNetFieldNames.SIZE.getFieldName());
|
||||
rule.setRuleOperator(OperatorTypes.EQUAL.getOperation());
|
||||
rule.setRuleUnit(DataSizeUtil.KB.getUnit());
|
||||
rule.setRuleUnit(DataSizeUnit.KB.getUnit());
|
||||
|
||||
assertTrue("Matches Dataset Size Equals Failed",
|
||||
rule.matches(sub, null));
|
||||
|
@ -120,12 +120,11 @@ public class RuleXMLTest {
|
|||
|
||||
@Test
|
||||
public void testMatchesSizeEqualsInMB() {
|
||||
System.out.println("Here 1");
|
||||
LatencyRuleXML rule = new LatencyRuleXML();
|
||||
rule.setRuleValue(String.valueOf(100));
|
||||
rule.setRuleField(OpsNetFieldNames.SIZE.getFieldName());
|
||||
rule.setRuleOperator(OperatorTypes.EQUAL.getOperation());
|
||||
rule.setRuleUnit(DataSizeUtil.MB.getUnit());
|
||||
rule.setRuleUnit(DataSizeUnit.MB.getUnit());
|
||||
|
||||
sub.setDataSetSize(1024 * 100);
|
||||
assertTrue("Matches Dataset Size Equals Failed",
|
||||
|
@ -134,12 +133,11 @@ public class RuleXMLTest {
|
|||
|
||||
@Test
|
||||
public void testMatchesSizeEqualsInGB() {
|
||||
System.out.println("Here 2");
|
||||
LatencyRuleXML rule = new LatencyRuleXML();
|
||||
rule.setRuleValue(String.valueOf(100));
|
||||
rule.setRuleField(OpsNetFieldNames.SIZE.getFieldName());
|
||||
rule.setRuleOperator(OperatorTypes.EQUAL.getOperation());
|
||||
rule.setRuleUnit(DataSizeUtil.GB.getUnit());
|
||||
rule.setRuleUnit(DataSizeUnit.GB.getUnit());
|
||||
|
||||
sub.setDataSetSize(100 * 1024 * 1024);
|
||||
assertTrue("Matches Dataset Size Equals Failed",
|
||||
|
|
|
@ -26,7 +26,7 @@ import static org.junit.Assert.assertThat;
|
|||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Test {@link DataSizeUtil}
|
||||
* Test {@link DataSizeUnit}
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -47,7 +47,7 @@ public class DataSizeUtilTest {
|
|||
|
||||
@Test
|
||||
public void testConvertOneKbInBytesToBytes() {
|
||||
long result = DataSizeUtil.BYTE.toByte(1024l);
|
||||
long result = DataSizeUnit.BYTE.toByte(1024l);
|
||||
|
||||
assertThat(result, is(equalTo(1024l)));
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ public class DataSizeUtilTest {
|
|||
public void testConvertOneKbInBytesToKB() {
|
||||
long bytes = 1024;
|
||||
long expected = 1;
|
||||
long result = DataSizeUtil.BYTE.toKB(bytes);
|
||||
long result = DataSizeUnit.BYTE.toKB(bytes);
|
||||
|
||||
assertThat(result, is(equalTo(expected)));
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ public class DataSizeUtilTest {
|
|||
public void testConvertOneMbInBytesToMB() {
|
||||
long bytes = CONV * CONV * 2;
|
||||
long expected = 2;
|
||||
long result = DataSizeUtil.BYTE.toMB(bytes);
|
||||
long result = DataSizeUnit.BYTE.toMB(bytes);
|
||||
|
||||
assertThat(result, is(equalTo(expected)));
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public class DataSizeUtilTest {
|
|||
public void testConvertTenBytesToMB() {
|
||||
long bytes = 10;
|
||||
long expected = 0;
|
||||
long result = DataSizeUtil.BYTE.toMB(bytes);
|
||||
long result = DataSizeUnit.BYTE.toMB(bytes);
|
||||
|
||||
assertThat(result, is(equalTo(expected)));
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ public class DataSizeUtilTest {
|
|||
public void testConvertTwoGbInBytesToGB() {
|
||||
long bytes = CONV * CONV * CONV * 2;
|
||||
long expected = 2;
|
||||
long result = DataSizeUtil.BYTE.toGB(bytes);
|
||||
long result = DataSizeUnit.BYTE.toGB(bytes);
|
||||
|
||||
assertThat(result, is(equalTo(expected)));
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ public class DataSizeUtilTest {
|
|||
public void testConvertTenBytesToGB() {
|
||||
long bytes = 10;
|
||||
long expected = 0;
|
||||
long result = DataSizeUtil.BYTE.toGB(bytes);
|
||||
long result = DataSizeUnit.BYTE.toGB(bytes);
|
||||
|
||||
assertThat(result, is(equalTo(expected)));
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ public class DataSizeUtilTest {
|
|||
public void testConvertMethodOneKbToByte() {
|
||||
long kb = 1;
|
||||
long expected = 1024;
|
||||
long result = DataSizeUtil.BYTE.convert(kb, DataSizeUtil.KB);
|
||||
long result = DataSizeUnit.BYTE.convert(kb, DataSizeUnit.KB);
|
||||
|
||||
assertThat(result, is(equalTo(expected)));
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ public class DataSizeUtilTest {
|
|||
public void testConvertOneKBToBytes() {
|
||||
long kb = 1;
|
||||
long expected = 1024;
|
||||
long result = DataSizeUtil.KB.toByte(kb);
|
||||
long result = DataSizeUnit.KB.toByte(kb);
|
||||
|
||||
assertThat(result, is(equalTo(expected)));
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ public class DataSizeUtilTest {
|
|||
public void testConvertOneKbToKB() {
|
||||
long kb = 1;
|
||||
long expected = 1;
|
||||
long result = DataSizeUtil.KB.toKB(kb);
|
||||
long result = DataSizeUnit.KB.toKB(kb);
|
||||
|
||||
assertThat(result, is(equalTo(expected)));
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ public class DataSizeUtilTest {
|
|||
public void testConvertOneKbToMB() {
|
||||
long kb = 1;
|
||||
long expected = 0;
|
||||
long result = DataSizeUtil.KB.toMB(kb);
|
||||
long result = DataSizeUnit.KB.toMB(kb);
|
||||
|
||||
assertThat(result, is(equalTo(expected)));
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ public class DataSizeUtilTest {
|
|||
public void testConvertTwoMbInKbToMB() {
|
||||
long kb = CONV * 2;
|
||||
long expected = 2;
|
||||
long result = DataSizeUtil.KB.toMB(kb);
|
||||
long result = DataSizeUnit.KB.toMB(kb);
|
||||
|
||||
assertThat(result, is(equalTo(expected)));
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ public class DataSizeUtilTest {
|
|||
public void testConvertOneKbToGB() {
|
||||
long kb = 1;
|
||||
long expected = 0;
|
||||
long result = DataSizeUtil.KB.toGB(kb);
|
||||
long result = DataSizeUnit.KB.toGB(kb);
|
||||
|
||||
assertThat(result, is(equalTo(expected)));
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ public class DataSizeUtilTest {
|
|||
public void testConvertTwoGbInKbToGB() {
|
||||
long kb = CONV * CONV * 2;
|
||||
long expected = 2;
|
||||
long result = DataSizeUtil.KB.toGB(kb);
|
||||
long result = DataSizeUnit.KB.toGB(kb);
|
||||
|
||||
assertThat(result, is(equalTo(expected)));
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ public class DataSizeUtilTest {
|
|||
public void testConvertMethodOneMbToKB() {
|
||||
long mb = 1;
|
||||
long expected = 1024;
|
||||
long result = DataSizeUtil.KB.convert(mb, DataSizeUtil.MB);
|
||||
long result = DataSizeUnit.KB.convert(mb, DataSizeUnit.MB);
|
||||
|
||||
assertThat(result, is(equalTo(expected)));
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ public class DataSizeUtilTest {
|
|||
public void testConvertOneMbToBytes() {
|
||||
long mb = 1;
|
||||
long expected = 1024 * 1024;
|
||||
long result = DataSizeUtil.MB.toByte(mb);
|
||||
long result = DataSizeUnit.MB.toByte(mb);
|
||||
|
||||
assertThat(result, is(equalTo(expected)));
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ public class DataSizeUtilTest {
|
|||
public void testConvertOneMbToKB() {
|
||||
long mb = 1;
|
||||
long expected = 1024;
|
||||
long result = DataSizeUtil.MB.toKB(mb);
|
||||
long result = DataSizeUnit.MB.toKB(mb);
|
||||
|
||||
assertThat(result, is(equalTo(expected)));
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ public class DataSizeUtilTest {
|
|||
public void testConvertTwoMbToMB() {
|
||||
long mb = 2;
|
||||
long expected = 2;
|
||||
long result = DataSizeUtil.MB.toMB(mb);
|
||||
long result = DataSizeUnit.MB.toMB(mb);
|
||||
|
||||
assertThat(result, is(equalTo(expected)));
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ public class DataSizeUtilTest {
|
|||
public void testConvertTwoMbToGB() {
|
||||
long mb = 2;
|
||||
long expected = 0;
|
||||
long result = DataSizeUtil.MB.toGB(mb);
|
||||
long result = DataSizeUnit.MB.toGB(mb);
|
||||
|
||||
assertThat(result, is(equalTo(expected)));
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ public class DataSizeUtilTest {
|
|||
public void testConvertTwoGbInMbToGB() {
|
||||
long mb = 1024 * 2;
|
||||
long expected = 2;
|
||||
long result = DataSizeUtil.MB.toGB(mb);
|
||||
long result = DataSizeUnit.MB.toGB(mb);
|
||||
|
||||
assertThat(result, is(equalTo(expected)));
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ public class DataSizeUtilTest {
|
|||
public void testConvertMethodOneGbToMB() {
|
||||
long gb = 1;
|
||||
long expected = 1024;
|
||||
long result = DataSizeUtil.MB.convert(gb, DataSizeUtil.GB);
|
||||
long result = DataSizeUnit.MB.convert(gb, DataSizeUnit.GB);
|
||||
|
||||
assertThat(result, is(equalTo(expected)));
|
||||
}
|
||||
|
@ -233,7 +233,7 @@ public class DataSizeUtilTest {
|
|||
public void testConvertOneGbToBytes() {
|
||||
long gb = 1;
|
||||
long expected = 1024 * 1024 * 1024;
|
||||
long result = DataSizeUtil.GB.toByte(gb);
|
||||
long result = DataSizeUnit.GB.toByte(gb);
|
||||
|
||||
assertThat(result, is(equalTo(expected)));
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ public class DataSizeUtilTest {
|
|||
public void testConvertOneGbToKB() {
|
||||
long gb = 1;
|
||||
long expected = 1024 * 1024;
|
||||
long result = DataSizeUtil.GB.toKB(gb);
|
||||
long result = DataSizeUnit.GB.toKB(gb);
|
||||
|
||||
assertThat(result, is(equalTo(expected)));
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ public class DataSizeUtilTest {
|
|||
public void testConvertOneGbToMB() {
|
||||
long gb = 1;
|
||||
long expected = 1024;
|
||||
long result = DataSizeUtil.GB.toMB(gb);
|
||||
long result = DataSizeUnit.GB.toMB(gb);
|
||||
|
||||
assertThat(result, is(equalTo(expected)));
|
||||
}
|
||||
|
@ -260,7 +260,7 @@ public class DataSizeUtilTest {
|
|||
public void testConvertOneGbToGB() {
|
||||
long gb = 1;
|
||||
long expected = 1;
|
||||
long result = DataSizeUtil.GB.toGB(gb);
|
||||
long result = DataSizeUnit.GB.toGB(gb);
|
||||
|
||||
assertThat(result, is(equalTo(expected)));
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ public class DataSizeUtilTest {
|
|||
public void testConvertMethodTwoGbToGB() {
|
||||
long gb = 2;
|
||||
long expected = 2;
|
||||
long result = DataSizeUtil.GB.convert(gb, DataSizeUtil.GB);
|
||||
long result = DataSizeUnit.GB.convert(gb, DataSizeUnit.GB);
|
||||
|
||||
assertThat(result, is(equalTo(expected)));
|
||||
}
|
||||
|
@ -277,7 +277,7 @@ public class DataSizeUtilTest {
|
|||
@Test
|
||||
public void testGetUnitByte() {
|
||||
String expected = "Byte";
|
||||
String result = DataSizeUtil.BYTE.getUnit();
|
||||
String result = DataSizeUnit.BYTE.getUnit();
|
||||
|
||||
assertThat(result, is(equalTo(expected)));
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ public class DataSizeUtilTest {
|
|||
@Test
|
||||
public void testGetUnitKB() {
|
||||
String expected = "KB";
|
||||
String result = DataSizeUtil.KB.getUnit();
|
||||
String result = DataSizeUnit.KB.getUnit();
|
||||
|
||||
assertThat(result, is(equalTo(expected)));
|
||||
}
|
||||
|
@ -293,7 +293,7 @@ public class DataSizeUtilTest {
|
|||
@Test
|
||||
public void testGetUnitMB() {
|
||||
String expected = "MB";
|
||||
String result = DataSizeUtil.MB.getUnit();
|
||||
String result = DataSizeUnit.MB.getUnit();
|
||||
|
||||
assertThat(result, is(equalTo(expected)));
|
||||
}
|
||||
|
@ -301,7 +301,7 @@ public class DataSizeUtilTest {
|
|||
@Test
|
||||
public void testGetUnitGB() {
|
||||
String expected = "GB";
|
||||
String result = DataSizeUtil.GB.getUnit();
|
||||
String result = DataSizeUnit.GB.getUnit();
|
||||
|
||||
assertThat(result, is(equalTo(expected)));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue