use of com.searchcode.app.dao.Data in project searchcode-server by boyter.
the class CommonRouteService method getMaxLineDepth.
public static double getMaxLineDepth() {
if (App.ISCOMMUNITY) {
return Double.parseDouble(Values.DEFAULTMAXLINEDEPTH);
}
Data data = Singleton.getData();
String matchLines = data.getDataByName(Values.MAXLINEDEPTH);
if (matchLines == null) {
data.saveData(Values.MAXLINEDEPTH, Values.DEFAULTMAXLINEDEPTH);
matchLines = Values.DEFAULTMAXLINEDEPTH;
}
return Double.parseDouble(matchLines);
}
use of com.searchcode.app.dao.Data in project searchcode-server by boyter.
the class CommonRouteService method owaspAdvisoriesEnabled.
public static boolean owaspAdvisoriesEnabled() {
if (App.ISCOMMUNITY) {
return false;
}
Data data = Singleton.getData();
Boolean owaspEnabled = Boolean.parseBoolean(data.getDataByName(Values.OWASPENABLED));
if (owaspEnabled == null) {
data.saveData(Values.OWASPENABLED, "false");
owaspEnabled = false;
}
return owaspEnabled;
}
use of com.searchcode.app.dao.Data in project searchcode-server by boyter.
the class CommonRouteService method getAverageSalary.
public static double getAverageSalary() {
if (App.ISCOMMUNITY) {
return Double.parseDouble(Values.DEFAULTAVERAGESALARY);
}
Data data = Singleton.getData();
String salary = data.getDataByName(Values.AVERAGESALARY);
if (salary == null) {
data.saveData(Values.AVERAGESALARY, Values.DEFAULTAVERAGESALARY);
salary = Values.DEFAULTAVERAGESALARY;
}
return Double.parseDouble(salary);
}
use of com.searchcode.app.dao.Data in project searchcode-server by boyter.
the class DataServiceTest method testTestRemoveFromPersistent.
public void testTestRemoveFromPersistent() {
Data mockData = Mockito.mock(Data.class);
DataService dataService = new DataService(mockData);
when(mockData.getDataByName(Values.PERSISTENT_DELETE_QUEUE, "[]")).thenReturn("[]");
dataService.removeFromPersistentDelete("test");
verify(mockData, times(1)).saveData(any(), any());
}
use of com.searchcode.app.dao.Data in project searchcode-server by boyter.
the class StatsServiceTest method testIncrementSearchCount.
public void testIncrementSearchCount() {
Data dataMock = Mockito.mock(Data.class);
when(dataMock.getDataByName(Values.CACHE_TOTAL_SEARCH, "0")).thenReturn(null);
StatsService statsService = new StatsService(dataMock);
statsService.incrementSearchCount();
verify(dataMock, times(1)).saveData(Values.CACHE_TOTAL_SEARCH, "1");
}
Aggregations