method2testcases stringlengths 118 6.63k |
|---|
### Question:
Benchmark { protected static byte[] fileAsBytes(String deviceDataFile) throws IOException { File file = new File(deviceDataFile); byte fileContent[] = new byte[(int) file.length()]; FileInputStream fin = new FileInputStream(file); try { int bytesRead = fin.read(fileContent); if (bytesRead != file.length()... |
### Question:
Match { void reset() { this.state.reset(); this.overriddenProfiles = null; this.cookie = null; this.propertyValueOverridesCookies = null; } Match(Provider provider); Match(Provider provider, String targetUserAgent); Dataset getDataSet(); String getTargetUserAgent(); long getElapsed(); Signature getSigna... |
### Question:
DatasetBuilder { public static BuildFromFile file() { return new DatasetBuilder().new BuildFromFile(); } private DatasetBuilder(); static BuildFromFile file(); static BuildFromBuffer buffer(); static final int STRINGS_CACHE_SIZE; static final int NODES_CACHE_SIZE; static final int VALUES_CACHE_SIZE; stat... |
### Question:
StreamFactory { public static IndirectDataset create(byte[] data) throws IOException { return DatasetBuilder.buffer() .configureDefaultCaches() .build(data); } static IndirectDataset create(byte[] data); static IndirectDataset create(String filePath); static IndirectDataset create(String filePath, boolea... |
### Question:
FindProfiles implements Closeable { public FindProfiles() throws IOException { provider = new Provider(StreamFactory.create(Shared.getLitePatternV32(), false)); } FindProfiles(); static void main(String[] args); @Override void close(); }### Answer:
@Test public void FindProfilesExample() throws IOExcepti... |
### Question:
Provider { public Match match(final Map<String, String> headers) throws IOException { return match(headers, createMatch()); } Provider(Dataset dataSet); Provider(Dataset dataSet, int cacheSize); Provider(Dataset dataSet, ILoadingCache cache); Provider(Dataset dataSet, boolean recordDetectionTime, ILoa... |
### Question:
DynamicFilters { public ArrayList<Signature> filterBy(String propertyName, String propertyValue, ArrayList<Signature> listToFilter) throws IOException { if (propertyName.isEmpty() || propertyValue.isEmpty()) { throw new IllegalArgumentException("Property and Value can not be " + "empty or null."); } if (l... |
### Question:
AllProfiles implements Closeable { public AllProfiles() throws IOException { provider = new Provider(StreamFactory.create( Shared.getLitePatternV32(), false)); hardwareComponent = provider.dataSet.getComponent("HardwarePlatform"); hardwareProperties = hardwareComponent.getProperties(); hardwareProfiles = ... |
### Question:
GettingStarted implements Closeable { public String detect(String userAgent) throws IOException { Match match = provider.match(userAgent); return match.getValues("IsMobile").toString(); } GettingStarted(); String detect(String userAgent); static void main(String[] args); @Override void close(); }### Answ... |
### Question:
OfflineProcessingExample implements Closeable { public void processCsv(String inputFileName, String outputFilename) throws IOException { BufferedReader bufferedReader = new BufferedReader(new FileReader(inputFileName)); try { FileWriter fileWriter = new FileWriter(outputFilename); try { Match match = prov... |
### Question:
ContentSummary implements Writable { @Override @InterfaceAudience.Private public void write(DataOutput out) throws IOException { out.writeLong(length); out.writeLong(fileCount); out.writeLong(directoryCount); out.writeLong(quota); out.writeLong(spaceConsumed); out.writeLong(spaceQuota); } @Deprecated Con... |
### Question:
ContentSummary implements Writable { @Override @InterfaceAudience.Private public void readFields(DataInput in) throws IOException { this.length = in.readLong(); this.fileCount = in.readLong(); this.directoryCount = in.readLong(); this.quota = in.readLong(); this.spaceConsumed = in.readLong(); this.spaceQu... |
### Question:
ContentSummary implements Writable { public static String getHeader(boolean qOption) { return qOption ? QUOTA_HEADER : HEADER; } @Deprecated ContentSummary(); @Deprecated ContentSummary(long length, long fileCount, long directoryCount); @Deprecated ContentSummary(
long length, long fileCount, lon... |
### Question:
DatanodeDescriptor extends DatanodeInfo { public Block[] getInvalidateBlocks(int maxblocks) { synchronized (invalidateBlocks) { Block[] deleteList = invalidateBlocks.pollToArray(new Block[Math.min( invalidateBlocks.size(), maxblocks)]); return deleteList.length == 0 ? null : deleteList; } } DatanodeDescri... |
### Question:
CommonNodeLabelsManager extends AbstractService { @SuppressWarnings("unchecked") public void addToCluserNodeLabels(Set<String> labels) throws IOException { if (!nodeLabelsEnabled) { LOG.error(NODE_LABELS_NOT_ENABLED_ERR); throw new IOException(NODE_LABELS_NOT_ENABLED_ERR); } if (null == labels || labels.i... |
### Question:
LinuxContainerExecutor extends ContainerExecutor { @Override public void setConf(Configuration conf) { super.setConf(conf); resourcesHandler = ReflectionUtils.newInstance( conf.getClass(YarnConfiguration.NM_LINUX_CONTAINER_RESOURCES_HANDLER, DefaultLCEResourcesHandler.class, LCEResourcesHandler.class), co... |
### Question:
LinuxContainerExecutor extends ContainerExecutor { @Override public boolean signalContainer(ContainerSignalContext ctx) throws IOException { Container container = ctx.getContainer(); String user = ctx.getUser(); String pid = ctx.getPid(); Signal signal = ctx.getSignal(); verifyUsernamePattern(user); Strin... |
### Question:
LinuxContainerExecutor extends ContainerExecutor { public void mountCgroups(List<String> cgroupKVs, String hierarchy) throws IOException { try { PrivilegedOperation mountCGroupsOp = new PrivilegedOperation( PrivilegedOperation.OperationType.MOUNT_CGROUPS, hierarchy); Configuration conf = super.getConf(); ... |
### Question:
DirectoryCollection { synchronized boolean createNonExistentDirs(FileContext localFs, FsPermission perm) { boolean failed = false; for (final String dir : localDirs) { try { createDir(localFs, new Path(dir), perm); } catch (IOException e) { LOG.warn("Unable to create directory " + dir + " error " + e.getM... |
### Question:
TrafficControlBandwidthHandlerImpl implements OutboundBandwidthResourceHandler { @Override public List<PrivilegedOperation> bootstrap(Configuration configuration) throws ResourceHandlerException { conf = configuration; cGroupsHandler .mountCGroupController(CGroupsHandler.CGroupController.NET_CLS); device ... |
### Question:
TrafficController { public int getClassIdFromFileContents(String input) { String classIdStr = String.format("%08x", Integer.parseInt(input)); if (LOG.isDebugEnabled()) { LOG.debug("ClassId hex string : " + classIdStr); } return Integer.parseInt(classIdStr.substring(4)); } TrafficController(Configuration c... |
### Question:
CGroupsHandlerImpl implements CGroupsHandler { @Override public void mountCGroupController(CGroupController controller) throws ResourceHandlerException { if (!enableCGroupMount) { LOG.warn("CGroup mounting is disabled - ignoring mount request for: " + controller.getName()); return; } String path = getCont... |
### Question:
DockerStopCommand extends DockerCommand { public DockerStopCommand setGracePeriod(int value) { super.addCommandArguments("--time=" + Integer.toString(value)); return this; } DockerStopCommand(String containerName); DockerStopCommand setGracePeriod(int value); }### Answer:
@Test public void testSetGracePe... |
### Question:
DockerInspectCommand extends DockerCommand { public DockerInspectCommand getContainerStatus() { super.addCommandArguments("--format='{{.State.Status}}'"); super.addCommandArguments(containerName); return this; } DockerInspectCommand(String containerName); DockerInspectCommand getContainerStatus(); }### A... |
### Question:
OwnLocalResources { public static Set<String> getLocalResourcesAllTags(){ Set<String> all = new HashSet<>(); all.add(LR_TAG_CENTOS6); all.add(LR_TAG_CENTOS7); all.add(LR_TAG_MACOS10); return all; } OwnLocalResources(String thisNodeTag); OwnLocalResources(); static Set<String> getLocalResourcesAllTags(); ... |
### Question:
OwnLocalResources { public Pair<String,Path> splitTagAndBasename(Path path){ String name = path.getName(); Path parent = path.getParent(); if(name.startsWith(LR_PREFIX) == false){ return null; } name = name.substring(LR_PREFIX.length()); int underscore = name.indexOf(LR_TAG_DELIM); if(underscore == -1){ r... |
### Question:
ContainerLaunch implements Callable<Integer> { @VisibleForTesting public static String expandEnvironment(String var, Path containerLogDir) { var = var.replace(ApplicationConstants.LOG_DIR_EXPANSION_VAR, containerLogDir.toString()); var = var.replace(ApplicationConstants.CLASS_PATH_SEPARATOR, File.pathSepa... |
### Question:
ProportionalCapacityPreemptionPolicy implements SchedulingEditPolicy { @VisibleForTesting static void sortContainers(List<RMContainer> containers){ Collections.sort(containers, new Comparator<RMContainer>() { @Override public int compare(RMContainer a, RMContainer b) { Comparator<Priority> c = new org.apa... |
### Question:
FifoScheduler extends
AbstractYarnScheduler<FiCaSchedulerApp, FiCaSchedulerNode> implements
Configurable { @Override public QueueInfo getQueueInfo(String queueName, boolean includeChildQueues, boolean recursive) { return DEFAULT_QUEUE.getQueueInfo(false, false); } FifoScheduler(); @Override void s... |
### Question:
FifoScheduler extends
AbstractYarnScheduler<FiCaSchedulerApp, FiCaSchedulerNode> implements
Configurable { @Override public synchronized List<ApplicationAttemptId> getAppsInQueue(String queueName) { if (queueName.equals(DEFAULT_QUEUE.getQueueName())) { List<ApplicationAttemptId> attempts = new Arr... |
### Question:
FairScheduler extends
AbstractYarnScheduler<FSAppAttempt, FSSchedulerNode> { @Override public void serviceInit(Configuration conf) throws Exception { initScheduler(conf); super.serviceInit(conf); } FairScheduler(); FairSchedulerConfiguration getConf(); QueueManager getQueueManager(); synchronized RMCo... |
### Question:
FairScheduler extends
AbstractYarnScheduler<FSAppAttempt, FSSchedulerNode> { @VisibleForTesting FSLeafQueue assignToQueue(RMApp rmApp, String queueName, String user) { FSLeafQueue queue = null; String appRejectMsg = null; try { QueuePlacementPolicy placementPolicy = allocConf.getPlacementPolicy(); que... |
### Question:
FairScheduler extends
AbstractYarnScheduler<FSAppAttempt, FSSchedulerNode> { @Override public void reinitialize(Configuration conf, RMContext rmContext) throws IOException { try { allocsLoader.reloadAllocations(); } catch (Exception e) { LOG.error("Failed to reload allocations file", e); } } FairSched... |
### Question:
FairScheduler extends
AbstractYarnScheduler<FSAppAttempt, FSSchedulerNode> { @Override public List<ApplicationAttemptId> getAppsInQueue(String queueName) { FSQueue queue = queueMgr.getQueue(queueName); if (queue == null) { return null; } List<ApplicationAttemptId> apps = new ArrayList<ApplicationAttem... |
### Question:
QueueMetrics implements MetricsSource { public synchronized static QueueMetrics forQueue(String queueName, Queue parent, boolean enableUserMetrics, Configuration conf) { return forQueue(DefaultMetricsSystem.instance(), queueName, parent, enableUserMetrics, conf); } protected QueueMetrics(MetricsSystem ms... |
### Question:
CapacityScheduler extends
AbstractYarnScheduler<FiCaSchedulerApp, FiCaSchedulerNode> implements
PreemptableResourceScheduler, CapacitySchedulerContext, Configurable { @Override public Comparator<FiCaSchedulerApp> getApplicationComparator() { return applicationComparator; } CapacityScheduler(); @Ov... |
### Question:
CapacityScheduler extends
AbstractYarnScheduler<FiCaSchedulerApp, FiCaSchedulerNode> implements
PreemptableResourceScheduler, CapacitySchedulerContext, Configurable { public CSQueue getQueue(String queueName) { if (queueName == null) { return null; } return queues.get(queueName); } CapacitySchedul... |
### Question:
ApplicationHistoryClientService extends AbstractService implements
ApplicationHistoryProtocol { @Override public GetApplicationReportResponse getApplicationReport( GetApplicationReportRequest request) throws YarnException, IOException { ApplicationId applicationId = request.getApplicationId(); try { G... |
### Question:
StringUtils { public static String escapeString(String str) { return escapeString(str, ESCAPE_CHAR, COMMA); } static String stringifyException(Throwable e); static String simpleHostname(String fullHostname); @Deprecated static String humanReadableInt(long number); static String format(final String format... |
### Question:
StringUtils { public static URI[] stringToURI(String[] str){ if (str == null) return null; URI[] uris = new URI[str.length]; for (int i = 0; i < str.length;i++){ try{ uris[i] = new URI(str[i]); }catch(URISyntaxException ur){ throw new IllegalArgumentException( "Failed to create uri for " + str[i], ur); } ... |
### Question:
StringUtils { public static String simpleHostname(String fullHostname) { if (InetAddresses.isInetAddress(fullHostname)) { return fullHostname; } int offset = fullHostname.indexOf('.'); if (offset != -1) { return fullHostname.substring(0, offset); } return fullHostname; } static String stringifyException(... |
### Question:
StringUtils { public static Collection<String> getTrimmedStringCollection(String str){ Set<String> set = new LinkedHashSet<String>( Arrays.asList(getTrimmedStrings(str))); set.remove(""); return set; } static String stringifyException(Throwable e); static String simpleHostname(String fullHostname); @Depr... |
### Question:
Count extends FsCommand { @Override protected void processOptions(LinkedList<String> args) { CommandFormat cf = new CommandFormat(1, Integer.MAX_VALUE, OPTION_QUOTA, OPTION_HUMAN, OPTION_HEADER); cf.parse(args); if (args.isEmpty()) { args.add("."); } showQuotas = cf.getOpt(OPTION_QUOTA); humanReadable = c... |
### Question:
GroovyWorld extends GroovyObjectSupport { public void registerWorld(Object world) { if (world instanceof GroovyObject) { worlds.add((GroovyObject) world); } else { throw new RuntimeException("Only GroovyObject supported"); } } GroovyWorld(); void registerWorld(Object world); Object getProperty(String prop... |
### Question:
Hooks { public static void Before(Object... args) { addHook(args, true, false); } static void World(Closure body); static void Before(Object... args); static void After(Object... args); static void AfterStep(Object... args); static void BeforeStep(Object... args); }### Answer:
@Test public void only_all... |
### Question:
XQueryRunConfig { public String getMainFile() { return getExpressionValue(mainFileExpression); } XQueryRunConfig(String xml); String getMainFile(); boolean isContextItemEnabled(); boolean isContextItemFromEditorEnabled(); String getContextItemFile(); String getContextItemText(); List<XQueryRunnerVariable>... |
### Question:
XQueryRunConfig { public String getHost() { return getExpressionValue(hostExpression); } XQueryRunConfig(String xml); String getMainFile(); boolean isContextItemEnabled(); boolean isContextItemFromEditorEnabled(); String getContextItemFile(); String getContextItemText(); List<XQueryRunnerVariable> getVari... |
### Question:
XQueryRunConfig { public String getPort() { return getExpressionValue(portExpression); } XQueryRunConfig(String xml); String getMainFile(); boolean isContextItemEnabled(); boolean isContextItemFromEditorEnabled(); String getContextItemFile(); String getContextItemText(); List<XQueryRunnerVariable> getVari... |
### Question:
XQueryRunConfig { public String getUsername() { return getExpressionValue(usernameExpression); } XQueryRunConfig(String xml); String getMainFile(); boolean isContextItemEnabled(); boolean isContextItemFromEditorEnabled(); String getContextItemFile(); String getContextItemText(); List<XQueryRunnerVariable>... |
### Question:
XQueryRunConfig { public String getPassword() { return getExpressionValue(passwordExpression); } XQueryRunConfig(String xml); String getMainFile(); boolean isContextItemEnabled(); boolean isContextItemFromEditorEnabled(); String getContextItemFile(); String getContextItemText(); List<XQueryRunnerVariable>... |
### Question:
XQueryRunConfig { public boolean isConfigFileEnabled() { return Boolean.parseBoolean(getExpressionValue(configFileEnabledExpression)); } XQueryRunConfig(String xml); String getMainFile(); boolean isContextItemEnabled(); boolean isContextItemFromEditorEnabled(); String getContextItemFile(); String getConte... |
### Question:
XQueryRunConfig { public String getConfigFile() { return getExpressionValue(configFileExpression); } XQueryRunConfig(String xml); String getMainFile(); boolean isContextItemEnabled(); boolean isContextItemFromEditorEnabled(); String getContextItemFile(); String getContextItemText(); List<XQueryRunnerVaria... |
### Question:
XQueryRunConfig { public String getDatabaseName() { return getExpressionValue(databaseNameExpression); } XQueryRunConfig(String xml); String getMainFile(); boolean isContextItemEnabled(); boolean isContextItemFromEditorEnabled(); String getContextItemFile(); String getContextItemText(); List<XQueryRunnerV... |
### Question:
XQueryRunConfig { public String getContextItemType() { return getExpressionValue(contextItemTypeExpression); } XQueryRunConfig(String xml); String getMainFile(); boolean isContextItemEnabled(); boolean isContextItemFromEditorEnabled(); String getContextItemFile(); String getContextItemText(); List<XQueryR... |
### Question:
OutputMethodFactory { public Properties getOutputMethodProperties() { Properties props = new Properties(); props.setProperty(METHOD_PROPERTY_NAME, OUTPUT_TYPE_XML); return props; } OutputMethodFactory(XQueryRunConfig config); Properties getOutputMethodProperties(); static final String METHOD_PROPERTY_NAME... |
### Question:
ConnectionFactory { public XQConnection getConnection(XQDataSource dataSource) throws Exception { XQConnection connection; if (config.getDataSourceType().connectionPropertiesAreSupported() && config.getUsername() != null && config.getUsername().length() > 0) { connection = dataSource.getConnection(config.... |
### Question:
XQueryRunConfig { public boolean isDebugEnabled() { return Boolean.parseBoolean(getExpressionValue(debugExpression)); } XQueryRunConfig(String xml); String getMainFile(); boolean isContextItemEnabled(); boolean isContextItemFromEditorEnabled(); String getContextItemFile(); String getContextItemText(); Lis... |
### Question:
DataSourceFactory { public XQDataSource getDataSource() throws Exception { XQueryDataSourceType dataSourceType = config.getDataSourceType(); XQDataSource dataSource = getXQDataSource(dataSourceType, config); if (dataSourceType.connectionPropertiesAreSupported()) { if (config.getHost() != null && config.ge... |
### Question:
XQueryRunConfig { public String getDebugPort() { return getExpressionValue(debugPortExpression); } XQueryRunConfig(String xml); String getMainFile(); boolean isContextItemEnabled(); boolean isContextItemFromEditorEnabled(); String getContextItemFile(); String getContextItemText(); List<XQueryRunnerVariabl... |
### Question:
ExpressionFactory { public XQPreparedExpression getExpression(XQConnection connection) throws Exception { XQPreparedExpression preparedExpression = connection .prepareExpression(contentFactory.getXQueryContentAsStream()); contextItemBinder.bindContextItem(connection, preparedExpression); variablesBinder.b... |
### Question:
AttributeBinder implements TypeBinder { @Override public void bind(XQPreparedExpression expression, XQConnection connection, QName name, String value, String type) throws Exception { expression.bindNode(name, createAttributeNode(value), getType(connection)); } @Override void bind(XQPreparedExpression exp... |
### Question:
AtomicValueBinder implements TypeBinder { @Override public void bind(XQPreparedExpression expression, XQConnection connection, QName name, String value, String type) throws Exception { expression.bindAtomicValue(name, value, getType(connection, type)); } @Override void bind(XQPreparedExpression expressio... |
### Question:
XQueryRunConfig { public boolean isContextItemEnabled() { return Boolean.parseBoolean(getExpressionValue(contextItemEnabledExpression)); } XQueryRunConfig(String xml); String getMainFile(); boolean isContextItemEnabled(); boolean isContextItemFromEditorEnabled(); String getContextItemFile(); String getCon... |
### Question:
TextBinder implements TypeBinder { @Override public void bind(XQPreparedExpression expression, XQConnection connection, QName name, String value, String type) throws Exception { expression.bindNode(name, createTextNode(value), getType(connection)); } @Override void bind(XQPreparedExpression expression, X... |
### Question:
DocumentBinder implements TypeBinder { @Override public void bind(XQPreparedExpression expression, XQConnection connection, QName name, String value, String type) throws Exception { expression.bindDocument(name, value, null, null); } @Override void bind(XQPreparedExpression expression, XQConnection conne... |
### Question:
NameExtractor { public QName getName(String name, String namespace) { String[] parts = name.split(":"); if (parts.length < 1 || parts.length > 2) { throw new RuntimeException("Variable name '" + name + "' is invalid"); } String namespacePrefix = null; String localPart = parts[parts.length - 1]; if (parts.... |
### Question:
XQueryRunConfig { public boolean isContextItemFromEditorEnabled() { return Boolean.parseBoolean(getExpressionValue(contextItemFromEditorEnabledExpression)); } XQueryRunConfig(String xml); String getMainFile(); boolean isContextItemEnabled(); boolean isContextItemFromEditorEnabled(); String getContextItemF... |
### Question:
XQueryRunConfig { public String getContextItemFile() { return getExpressionValue(contextItemFileExpression); } XQueryRunConfig(String xml); String getMainFile(); boolean isContextItemEnabled(); boolean isContextItemFromEditorEnabled(); String getContextItemFile(); String getContextItemText(); List<XQueryR... |
### Question:
XQueryRunConfig { public String getContextItemText() { return getExpressionValue(contextItemTextExpression); } XQueryRunConfig(String xml); String getMainFile(); boolean isContextItemEnabled(); boolean isContextItemFromEditorEnabled(); String getContextItemFile(); String getContextItemText(); List<XQueryR... |
### Question:
XQueryRunConfig { public List<XQueryRunnerVariable> getVariables() { String count = getExpressionValue(numberOfVariablesExpression); int numberOfVariables = Integer.valueOf(count); List<XQueryRunnerVariable> result = new ArrayList<XQueryRunnerVariable>(numberOfVariables); for (int i = 1; i <= numberOfVari... |
### Question:
XQueryRunConfig { public XQueryDataSourceType getDataSourceType() { return XQueryDataSourceType.getForName(getExpressionValue(dataSourceTypeExpression)); } XQueryRunConfig(String xml); String getMainFile(); boolean isContextItemEnabled(); boolean isContextItemFromEditorEnabled(); String getContextItemFile... |
### Question:
TaskChain { public void doInvoke() { if (taskItemList.isEmpty()) { return; } for(TaskItem item : taskItemList) { BusinessWrapper<String> result = item.runTask(); callback.doNotify(result); if (!result.isSuccess()) { logger.warn("run task={} failure, result={}", item.getTaskName(), result.getMsg()); break;... |
### Question:
EmailService { public boolean doSendNewTodo(UserDO userDO, TodoDailyVO dailyVO, UserDO sponsorUser) { logger.info("send new todo email to:" + userDO.getUsername() + " for id:" + dailyVO.getId()); try { HtmlEmail email = buildHtmlEmail(userDO.getMail(), userDO.getDisplayName()); email.setHtmlMsg(TplUtils.d... |
### Question:
AliyunLogManageServiceImpl implements AliyunLogManageService { private List<Project> queryListProject(String project) { Client client = aliyunLogService.acqClient(); int offset = 0; int size = 100; String logStoreSubName = ""; ListProjectRequest req = new ListProjectRequest(project, offset, size); List<Pr... |
### Question:
AliyunLogManageServiceImpl implements AliyunLogManageService { @Override public List<String> queryListLogStores(String project) { Client client = aliyunLogService.acqClient(); int offset = 0; int size = 100; String logStoreSubName = ""; ListLogStoresRequest req = new ListLogStoresRequest(project, offset, ... |
### Question:
AliyunLogManageServiceImpl implements AliyunLogManageService { @Override public List<String> queryListMachineGroup(String project, String groupName) { Client client = aliyunLogService.acqClient(); int offset = 0; int size = 50; ListMachineGroupRequest req = new ListMachineGroupRequest(project, groupName, ... |
### Question:
AliyunLogManageServiceImpl implements AliyunLogManageService { @Override public MachineGroup getMachineGroup(String project, String groupName) { Client client = aliyunLogService.acqClient(); GetMachineGroupRequest req = new GetMachineGroupRequest(project, groupName); MachineGroup machineGroup = new Machin... |
### Question:
AliyunLogManageServiceImpl implements AliyunLogManageService { @Override public BusinessWrapper<Boolean> saveServerGroupCfg(LogServiceServerGroupCfgVO cfgVO) { if (StringUtils.isEmpty(cfgVO.getTopic())) cfgVO.setTopic(cfgVO.getServerGroupDO().getName()); if (StringUtils.isEmpty(cfgVO.getServerGroupName())... |
### Question:
IP { public String getIPSection(){ if(ip==null) return null; if(netmask == null || netmask.equals("32")){ return ip; } else{ return ip+"/"+netmask; } } IP(String ip); IP(String ip, String netmask); IP(String ip, String netmask, String getway); String getIp(); Boolean isPublicIP(); String toString(); Str... |
### Question:
AliyunLogServiceImpl implements AliyunLogService { public void readLog(String project, String logstore) { Client client = acqClient(); int shard_id = 0; long curTimeInSec = System.currentTimeMillis() / 1000; try { GetCursorResponse cursorRes = client.GetCursor(project, logstore, shard_id, curTimeInSec - 3... |
### Question:
ExplainServiceImpl implements ExplainService { @Override public Set<String> doScanRepo(ExplainDTO explainDTO) { try { Git git = GitProcessor.cloneRepository(localPath + "/explain/" + explainDTO.getId() + "/", explainDTO.getRepo(), username, pwd, Collections.EMPTY_LIST); Set<String> refSet = GitProcessor.g... |
### Question:
TodoServiceImpl implements TodoService { public List<TodoDetailVO> queryMyTodoJob(String username) { List<UserDO> users = authService.queryUsersByRoleName(TodoDO.TodoTypeEnum.devops.getDesc()); boolean isDevops = false; List<TodoDetailDO> todoDetailList = new ArrayList<>(); for (UserDO userDO : users) { i... |
### Question:
IptablesRule { public String getRule() { buildRuleByType(); return getDesc() + getRuleHead() + ruleBody; } IptablesRule(String port, List<IP> ips, int ruleType, String desc); IptablesRule(String port, List<IP> ips, String desc); IptablesRule(String port, String desc); IptablesRule(List<IP> ips, String ... |
### Question:
ZabbixHistoryServiceImpl implements ZabbixHistoryService { @Override public JSONObject queryCpuUser(ServerDO serverDO, int limit) { return historyGet(serverDO, null, ZabbixHistoryItemEnum.CPU_USER.getItemKey(), historyTypeNumericFloat, limit); } @Override String acqResultValue(JSONObject response); @Over... |
### Question:
ZabbixServiceImpl implements ZabbixService, InitializingBean { @Override public int usergroupCreate(ServerGroupDO serverGroupDO) { String usergrpName = serverGroupDO.getName().replace("group_", "users_"); int id = usergroupGet(usergrpName); if (id != 0) return id; ZabbixRequest request = ZabbixRequestBuil... |
### Question:
ZabbixServiceImpl implements ZabbixService, InitializingBean { @Override public BusinessWrapper<Boolean> userCreate(UserDO userDO) { if (userDO == null) return new BusinessWrapper<>(ErrorCode.userNotExist.getCode(), ErrorCode.userNotExist.getMsg()); ZabbixRequest request = ZabbixRequestBuilder.newBuilder(... |
### Question:
ZabbixServiceImpl implements ZabbixService, InitializingBean { @Override public BusinessWrapper<Boolean> userDelete(UserDO userDO) { if (userDO == null) return new BusinessWrapper<>(ErrorCode.userNotExist.getCode(), ErrorCode.userNotExist.getMsg()); int userid = this.userGet(userDO); if (userid == 0) retu... |
### Question:
ZabbixServiceImpl implements ZabbixService, InitializingBean { @Override public BusinessWrapper<Boolean> syncUser() { List<UserDO> listUserDO = userDao.getAllUser(); for (UserDO userDO : listUserDO) { if (userDO.getAuthed() == UserDO.AuthType.noAuth.getCode()) continue; if (userGet(userDO) != 0) { userDO.... |
### Question:
ZabbixServiceImpl implements ZabbixService, InitializingBean { @Override public BusinessWrapper<Boolean> userUpdate(UserDO userDO) { if (userDO == null) return new BusinessWrapper<>(ErrorCode.userNotExist.getCode(), ErrorCode.userNotExist.getMsg()); ZabbixRequest request = ZabbixRequestBuilder.newBuilder(... |
### Question:
ZabbixServiceImpl implements ZabbixService, InitializingBean { private int actionGet(ServerGroupDO serverGroupDO) { if (serverGroupDO == null) return 0; String usergrpName = serverGroupDO.getName().replace("group_", "users_"); ZabbixRequest request = ZabbixRequestBuilder.newBuilder() .method("action.get")... |
### Question:
Iptables { public String toBody() { body = getInfo(); body = body + getDesc(); for (IptablesRule ir : irList) { body = body + ir.getRule() +"\n"; } return body; } Iptables(List<IptablesRule> irList, String desc); Iptables(IptablesRule ir, String desc); String toBody(); }### Answer:
@Test public void tes... |
### Question:
ZabbixServiceImpl implements ZabbixService, InitializingBean { private boolean hostDelete(ServerDO serverDO) { if (serverDO == null) return false; int hostid = hostGet(serverDO); if (hostid == 0) return true; ZabbixRequest request = ZabbixRequestBuilder.newBuilder() .method("host.delete").paramEntry("para... |
### Question:
ZabbixServiceImpl implements ZabbixService, InitializingBean { private boolean hostCreate(ServerDO serverDO) { if (hostExists(serverDO)) return true; if (!hostgroupCreate(serverDO)) return false; ZabbixRequest request = ZabbixRequestBuilder.newBuilder() .method("host.create").build(); request.putParam("ho... |
### Question:
ZabbixServiceImpl implements ZabbixService, InitializingBean { @Override public boolean hostExists(ServerDO serverDO) { if (hostGet(serverDO) == 0) return false; return true; } @Override String getApiVersion(); @Override boolean hostExists(ServerDO serverDO); @Override int hostGetStatus(ServerDO serverDO... |
### Question:
ZabbixServiceImpl implements ZabbixService, InitializingBean { @Override public int hostGetStatus(ServerDO serverDO) { if (serverDO == null) return 0; JSONObject filter = new JSONObject(); filter.put("ip", acqServerMonitorIp(serverDO)); JSONObject getResponse = call(ZabbixRequestBuilder.newBuilder() .meth... |
### Question:
ZabbixServiceImpl implements ZabbixService, InitializingBean { public int itemGet(ServerDO serverDO, String itemName, String itemKey) { if (serverDO == null) return 0; ZabbixRequest request = ZabbixRequestBuilder.newBuilder() .method("item.get").build(); request.putParam("output", "extend"); request.putPa... |
### Question:
ZabbixServiceImpl implements ZabbixService, InitializingBean { public void api(int statusType, String key, String project, String group, String env) { if (!apiCheckKey(key)) return; ServerGroupDO serverGroupDO = serverGroupDao.queryServerGroupByName("group_" + project); if (serverGroupDO == null) return; ... |
### Question:
ZabbixServiceImpl implements ZabbixService, InitializingBean { public int checkUserInUsergroup(UserDO userDO, ServerGroupDO serverGroupDO) { int userid = this.userGet(userDO); if (userid == 0) return 2; String usergrpName = serverGroupDO.getName().replace("group_", "users_"); int usrgrpid = usergroupGet(u... |
### Question:
RemoteInvokeHandler { public static ConnectionSession getSession(ApplicationKeyDO applicationKeyDO, HostSystem hostSystem) { JSch jSch = new JSch(); String passphrase = applicationKeyDO.getPassphrase(); if (StringUtils.isEmpty(passphrase)) { passphrase = ""; } try { jSch.addIdentity(applicationKeyDO.getSe... |
### Question:
Getway { public Getway() { } Getway(); Getway(UserDO userDO, List<ServerGroupDO> serverGroups); Getway(List<ServerGroupDO> serverGroups, Map<String, List<ServerDO>> servers); String getPath(); void addUser(UserDO userDO); void addServerGroup(List<ServerGroupDO> serverGroups); void addServers(Map<String,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.