当前位置: 首页>>代码示例>>Java>>正文


Java VictimsDB.db方法代码示例

本文整理汇总了Java中com.redhat.victims.database.VictimsDB.db方法的典型用法代码示例。如果您正苦于以下问题:Java VictimsDB.db方法的具体用法?Java VictimsDB.db怎么用?Java VictimsDB.db使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.redhat.victims.database.VictimsDB的用法示例。


在下文中一共展示了VictimsDB.db方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testDerby

import com.redhat.victims.database.VictimsDB; //导入方法依赖的package包/类
@Test(expected = VictimsException.class)
public void testDerby() throws IOException, VictimsException {
    String old = System.getProperty(VictimsConfig.Key.DB_DRIVER);
    try {
        System.setProperty(VictimsConfig.Key.DB_DRIVER,
                "org.apache.derby.jdbc.EmbeddedDriver");
        VictimsDBInterface vdb = VictimsDB.db();
        vdb.synchronize();
    } finally {
        if (old != null) {
            System.setProperty(VictimsConfig.Key.DB_DRIVER, old);
        } else {
            System.clearProperty(VictimsConfig.Key.DB_DRIVER);
        }
    }

}
 
开发者ID:victims,项目名称:victims-lib-java,代码行数:18,代码来源:VictimsDatabaseTest.java

示例2: getVictimsDB

import com.redhat.victims.database.VictimsDB; //导入方法依赖的package包/类
/**
 * sync and return victims db
 *
 * @return victims db
 */
private VictimsDBInterface getVictimsDB() {
	VictimsDBInterface db = null;
	try {
		db = VictimsDB.db();
		//todo add option and logic to set update interval
		db.synchronize();
	} catch (Exception ex) {
		log.error(ex.getMessage(), ex);
	}
	return db;
}
 
开发者ID:skavanagh,项目名称:victims-plugin-nexus,代码行数:17,代码来源:VictimsNexusScanner.java

示例3: testPurgeOnSync

import com.redhat.victims.database.VictimsDB; //导入方法依赖的package包/类
@Test
public void testPurgeOnSync() throws VictimsException {
    String hash = "0";
    VictimsResultCache vrc = prepareCache(hash);
    VictimsDBInterface vdb = VictimsDB.db();
    vdb.synchronize();
    assertTrue("Cache was not correctly purged on database sync.",
            !vrc.exists(hash));
}
 
开发者ID:victims,项目名称:victims-lib-java,代码行数:10,代码来源:VictimsResultCacheTest.java

示例4: execute

import com.redhat.victims.database.VictimsDB; //导入方法依赖的package包/类
@Override
public CommandResult execute(List<String> args) {
    try { 
        VictimsDBInterface db = VictimsDB.db();
        db.synchronize();
        ExitSuccess result = new ExitSuccess(null);
        result.addVerboseOutput("synchronization complete!");
        return result;
                
    } catch (VictimsException e){
        //e.printStackTrace();
        return new ExitFailure(e.getMessage());
    }
}
 
开发者ID:victims,项目名称:victims-client-java-legacy,代码行数:15,代码来源:SynchronizeCommand.java

示例5: setupExecutionContext

import com.redhat.victims.database.VictimsDB; //导入方法依赖的package包/类
private void setupExecutionContext(PrintStream log) throws AbortException {
    ctx = new ExecutionContext();
    ctx.setSettings(new Settings());
    ctx.setLog(log);

    ctx.getSettings().set(VictimsConfig.Key.URI, baseUrl);
    ctx.getSettings().set(VictimsConfig.Key.DB_DRIVER, jdbcDriver);
    ctx.getSettings().set(VictimsConfig.Key.DB_URL, jdbcUrl);
    ctx.getSettings().set(Settings.METADATA, metadata);
    ctx.getSettings().set(Settings.FINGERPRINT, fingerprint);
    ctx.getSettings().set(VictimsConfig.Key.ENTRY, entryPoint);
    ctx.getSettings().set(VictimsConfig.Key.DB_USER, jdbcUsername);
    ctx.getSettings().set(VictimsConfig.Key.DB_PASS, jdbcPassword);
    ctx.getSettings().set(Settings.UPDATE_DATABASE, updates);

    System.setProperty(VictimsConfig.Key.ALGORITHMS, "SHA512");

    try {
        VictimsResultCache cache = new VictimsResultCache();
        ctx.setCache(cache);

        VictimsDBInterface db = VictimsDB.db();
        ctx.setDatabase(db);

        ctx.getSettings().validate();
        ctx.getSettings().show(ctx.getLog());
    } catch (VictimsException e) {
        log.println("[VICTIMS] ERROR:");
        log.println(e.getMessage());
        throw new AbortException();
    }
}
 
开发者ID:victims,项目名称:victims-plugin-jenkins-legacy,代码行数:33,代码来源:VictimsPostBuildScanner.java

示例6: sync

import com.redhat.victims.database.VictimsDB; //导入方法依赖的package包/类
public static void sync() throws VictimsException {
    vdb = VictimsDB.db();
    vdb.synchronize();
}
 
开发者ID:victims,项目名称:victims-lib-java,代码行数:5,代码来源:VictimsDatabaseTest.java

示例7: testResync

import com.redhat.victims.database.VictimsDB; //导入方法依赖的package包/类
@Test
public void testResync() throws VictimsException {
    VictimsDBInterface vdb = VictimsDB.db();
    vdb.synchronize();
}
 
开发者ID:victims,项目名称:victims-lib-java,代码行数:6,代码来源:VictimsDatabaseTest.java

示例8: VictimScan

import com.redhat.victims.database.VictimsDB; //导入方法依赖的package包/类
/**
 * Initialises the scan.
 * 
 * @param set
 *            Victims settings map
 * @param paths
 *            Absolute paths to projects dependencies
 * @throws VictimsException
 */
public VictimScan(Map<String, String> set, ArrayList<IPath> paths)
		throws VictimsException {
	this.paths = paths;

	/* Set up context */
	ctx = new ExecutionContext();
	ctx.setSettings(new Settings());
	log = ctx.getLog();
	Driver driver = new Driver();
	/* Apply user supplied/default settings from option menu */
	Settings settings = ctx.getSettings();
	settings.set(VictimsConfig.Key.URI, set.get(VictimsConfig.Key.URI));
	System.setProperty(VictimsConfig.Key.URI,
			set.get(VictimsConfig.Key.URI));
	settings.set(VictimsConfig.Key.DB_DRIVER,
			set.get(VictimsConfig.Key.DB_DRIVER));
	System.setProperty(VictimsConfig.Key.DB_DRIVER,
			set.get(VictimsConfig.Key.DB_DRIVER));
	settings.set(VictimsConfig.Key.DB_URL,
			set.get(VictimsConfig.Key.DB_URL));
	System.setProperty(VictimsConfig.Key.DB_URL,
			set.get(VictimsConfig.Key.DB_URL));
	settings.set(VictimsConfig.Key.ENTRY, set.get(VictimsConfig.Key.ENTRY));
	System.setProperty(VictimsConfig.Key.ENTRY,
			set.get(VictimsConfig.Key.ENTRY));
	settings.set(VictimsConfig.Key.DB_USER,
			set.get(VictimsConfig.Key.DB_USER));
	System.setProperty(VictimsConfig.Key.DB_USER,
			set.get(VictimsConfig.Key.DB_USER));
	settings.set(VictimsConfig.Key.DB_PASS, "(not shown)");
	System.setProperty(VictimsConfig.Key.DB_PASS,
			set.get(VictimsConfig.Key.DB_PASS));
	settings.set(Settings.METADATA, set.get(Settings.METADATA));
	settings.set(Settings.FINGERPRINT, set.get(Settings.FINGERPRINT));
	settings.set(Settings.UPDATE_DATABASE,
			set.get(Settings.UPDATE_DATABASE));

	// Only use 1 algorithm for comparisons
	System.setProperty(VictimsConfig.Key.ALGORITHMS, "SHA512");

	/* Create results cache & victims DB */
	VictimsResultCache cache = new VictimsResultCache();
	ctx.setCache(cache);
	driver.getClass();
	VictimsDBInterface db = VictimsDB.db();
	ctx.setDatabase(db);

	// validate
	ctx.getSettings().validate();
	ctx.getSettings().show(ctx.getLog());

}
 
开发者ID:victims,项目名称:victims-plugin-eclipse-legacy,代码行数:62,代码来源:VictimScan.java

示例9: getDatabase

import com.redhat.victims.database.VictimsDB; //导入方法依赖的package包/类
public VictimsDBInterface getDatabase() throws VictimsException {
    if (database == null){
        database = VictimsDB.db();
    }
    return database;
}
 
开发者ID:victims,项目名称:victims-client-java-legacy,代码行数:7,代码来源:Environment.java

示例10: sync

import com.redhat.victims.database.VictimsDB; //导入方法依赖的package包/类
public static void sync() throws VictimsException {
	vdb = VictimsDB.db();
	vdb.synchronize();
}
 
开发者ID:victims,项目名称:victims-plugin-ant-legacy,代码行数:5,代码来源:.VictimsCommandTest.java


注:本文中的com.redhat.victims.database.VictimsDB.db方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。