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


Java Version类代码示例

本文整理汇总了Java中ca.sqlpower.util.Version的典型用法代码示例。如果您正苦于以下问题:Java Version类的具体用法?Java Version怎么用?Java Version使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: testVersionNumberOlderThanNow

import ca.sqlpower.util.Version; //导入依赖的package包/类
/**
 * If the version number's minor version is less than the current version the 
 * user should be notified.
 */
public void testVersionNumberOlderThanNow() throws Exception {
    CountingPromptContext context = new CountingPromptContext();
    
    Version currentVersion = WorkspaceXMLDAO.FILE_VERSION;
    StringBuffer buffer = new StringBuffer();
    buffer.append(currentVersion.getParts()[0]).append(".");
    buffer.append(((Integer) currentVersion.getParts()[1]) - 1);
    for (int i = 2; i < currentVersion.getParts().length; i++) {
        buffer.append(".").append(currentVersion.getParts()[i]);
    }
    String noVersionProject = "<?xml version='1.0' encoding='UTF-8'?>\n" +
        "<wabit export-format=\"" + buffer.toString() + "\" wabit-app-version=\"0.9.9\">\n" +
        "<project name=\"aaaaa\">\n" +
        "</project>\n" +
        "</wabit>";
    
    ByteArrayInputStream in = new ByteArrayInputStream(noVersionProject.getBytes());
    
    OpenWorkspaceXMLDAO loadDAO = new OpenWorkspaceXMLDAO(context, in, 
            OpenWorkspaceXMLDAO.UNKNOWN_STREAM_LENGTH);
    
    loadDAO.openWorkspaces();
    
    assertEquals(1, context.getTimesUserWasPrompted());
}
 
开发者ID:SQLPower,项目名称:wabit,代码行数:30,代码来源:WorkspaceSAXHandlerTest.java

示例2: testVersionNewerThanNow

import ca.sqlpower.util.Version; //导入依赖的package包/类
/**
 * If the version number's newer than the current file version that Wabit saves
 * the user should be notified.
 */
public void testVersionNewerThanNow() throws Exception {
    CountingPromptContext context = new CountingPromptContext();
    
    Version currentVersion = WorkspaceXMLDAO.FILE_VERSION;
    StringBuffer buffer = new StringBuffer();
    buffer.append(currentVersion.getParts()[0]).append(".");
    buffer.append(((Integer) currentVersion.getParts()[1]) + 1);
    for (int i = 2; i < currentVersion.getParts().length; i++) {
        buffer.append(".").append(currentVersion.getParts()[i]);
    }
    String noVersionProject = "<?xml version='1.0' encoding='UTF-8'?>\n" +
        "<wabit export-format=\"" + buffer.toString() + "\" wabit-app-version=\"0.9.9\">\n" +
        "<project name=\"aaaaa\">\n" +
        "</project>\n" +
        "</wabit>";
    
    ByteArrayInputStream in = new ByteArrayInputStream(noVersionProject.getBytes());
    
    OpenWorkspaceXMLDAO loadDAO = new OpenWorkspaceXMLDAO(context, in, 
            OpenWorkspaceXMLDAO.UNKNOWN_STREAM_LENGTH);
    
    loadDAO.openWorkspaces();
    
    assertEquals(1, context.getTimesUserWasPrompted());
}
 
开发者ID:SQLPower,项目名称:wabit,代码行数:30,代码来源:WorkspaceSAXHandlerTest.java

示例3: SPServerInfoManager

import ca.sqlpower.util.Version; //导入依赖的package包/类
/**
 * Creates an {@link SPServerInfoManager} and populates it with existing
 * SPServerInfo configurations loaded from the user's Preferences
 * 
 * @param prefs
 *            The Preferences node under which the manually-configured
 *            server information is stored.
 * @param clientVersion
 *            A Version containing the version of this client to be used to
 *            determine compatibility with servers
 * @throws BackingStoreException
 *             If there is a failure in the backing store while reading the
 *             Preferences node
 */
public SPServerInfoManager(Preferences prefs, Version clientVersion, SPServerInfo defaultSettings) throws BackingStoreException {
	servers = new ArrayList<SPServerInfo>();
	listeners = new ArrayList<ServerListListener>();
	this.serverPrefs = prefs;
	this.clientVersion = clientVersion;
	this.defaultSettings = defaultSettings;
       for (String nodeName : serverPrefs.childrenNames()) {
           Preferences serverNode = serverPrefs.node(nodeName);
           if (defaultSettings.isPasswordAllowed()) {
           	servers.add(new SPServerInfo(
           			serverNode.get("name", null),
           			serverNode.get("serverAddress", null),
           			serverNode.getInt("port", 0),
           			serverNode.get("path", null),
           			serverNode.get("username", ""),
           			serverNode.get("password", "")));
           } else {
           	servers.add(new SPServerInfo(
           			serverNode.get("scheme", "https"),
                       serverNode.get("name", null),
                       serverNode.get("serverAddress", null),
                       serverNode.getInt("port", 0),
                       serverNode.get("path", null),
                       serverNode.get("username", "")));
           }
       }
}
 
开发者ID:SQLPower,项目名称:sqlpower-library,代码行数:42,代码来源:SPServerInfoManager.java

示例4: getServerVersion

import ca.sqlpower.util.Version; //导入依赖的package包/类
public static Version getServerVersion(
		String host,
		String port,
		String path, 
		String username, 
		String password,
		CookieStore cookieStore) throws MalformedURLException,IOException 
{
	init(toURL(host, port, path), username, password, cookieStore);
	return version.get(generateServerKey(host, port, path, username, password));
}
 
开发者ID:SQLPower,项目名称:sqlpower-library,代码行数:12,代码来源:ServerInfoProvider.java

示例5: getServerVersion

import ca.sqlpower.util.Version; //导入依赖的package包/类
public static Version getServerVersion(
		String host,
		String port,
		String path, 
		String username, 
		String password) throws MalformedURLException,IOException 
{
	init(host, port, path, username, password);
	return version.get(generateServerKey(host, port, path, username, password));
}
 
开发者ID:SQLPower,项目名称:wabit,代码行数:11,代码来源:ServerInfoProvider.java

示例6: testCancelExceptionOnLaterMajorVersion

import ca.sqlpower.util.Version; //导入依赖的package包/类
/**
 * If the file being loaded by the sax handler has a version number whose
 * major version is later than the current one it should cancel the loading
 * by throwing a CancellationException.
 */
public void testCancelExceptionOnLaterMajorVersion() throws Exception {
    CountingPromptContext context = new CountingPromptContext();
    
    Version currentVersion = WorkspaceXMLDAO.FILE_VERSION;
    StringBuffer buffer = new StringBuffer();
    buffer.append(((Integer) currentVersion.getParts()[0]) + 1);
    for (int i = 1; i < currentVersion.getParts().length; i++) {
        buffer.append(".").append(currentVersion.getParts()[i]);
    }
    String noVersionProject = "<?xml version='1.0' encoding='UTF-8'?>\n" +
        "<wabit export-format=\"" + buffer.toString() + "\" wabit-app-version=\"0.9.9\">\n" +
        "<project name=\"aaaaa\">\n" +
        "</project>\n" +
        "</wabit>";
    
    ByteArrayInputStream in = new ByteArrayInputStream(noVersionProject.getBytes());
    
    SAXParser parser;
    WorkspaceSAXHandler saxHandler = new WorkspaceSAXHandler(context);

    try {
        parser = SAXParserFactory.newInstance().newSAXParser();
        parser.parse(in, saxHandler);
        fail("The file should not load if the file has a later major or minor version" +
        		"than the currently supported version.");
    } catch (CancellationException e) {
        //do nothing on a cancellation
    }
}
 
开发者ID:SQLPower,项目名称:wabit,代码行数:35,代码来源:WorkspaceSAXHandlerTest.java

示例7: testCancelExceptionOnLaterMinorVersion

import ca.sqlpower.util.Version; //导入依赖的package包/类
/**
 * If the file being loaded by the sax handler has a version number whose
 * minor version is later than the current one it should cancel the loading
 * by throwing a CancellationException.
 */
public void testCancelExceptionOnLaterMinorVersion() throws Exception {
    CountingPromptContext context = new CountingPromptContext();
    
    Version currentVersion = WorkspaceXMLDAO.FILE_VERSION;
    StringBuffer buffer = new StringBuffer();
    buffer.append(currentVersion.getParts()[0]).append(".");
    buffer.append(((Integer) currentVersion.getParts()[1]) + 1);
    for (int i = 2; i < currentVersion.getParts().length; i++) {
        buffer.append(".").append(currentVersion.getParts()[i]);
    }
    String noVersionProject = "<?xml version='1.0' encoding='UTF-8'?>\n" +
        "<wabit export-format=\"" + buffer.toString() + "\" wabit-app-version=\"0.9.9\">\n" +
        "<project name=\"aaaaa\">\n" +
        "</project>\n" +
        "</wabit>";
    
    ByteArrayInputStream in = new ByteArrayInputStream(noVersionProject.getBytes());
    
    SAXParser parser;
    WorkspaceSAXHandler saxHandler = new WorkspaceSAXHandler(context);

    try {
        parser = SAXParserFactory.newInstance().newSAXParser();
        parser.parse(in, saxHandler);
        fail("The file should not load if the file has a later major or minor version" +
                "than the currently supported version.");
    } catch (CancellationException e) {
        //do nothing on a cancellation
    }
}
 
开发者ID:SQLPower,项目名称:wabit,代码行数:36,代码来源:WorkspaceSAXHandlerTest.java

示例8: testCancelExceptionOnEarlierMajorVersion

import ca.sqlpower.util.Version; //导入依赖的package包/类
/**
 * If the file being loaded by the sax handler has a version number whose
 * major version is before than the current one it should cancel the loading
 * by throwing a CancellationException.
 */
public void testCancelExceptionOnEarlierMajorVersion() throws Exception {
    CountingPromptContext context = new CountingPromptContext();
    
    Version currentVersion = WorkspaceXMLDAO.FILE_VERSION;
    StringBuffer buffer = new StringBuffer();
    buffer.append(((Integer) currentVersion.getParts()[0]) - 1);
    for (int i = 1; i < currentVersion.getParts().length; i++) {
        buffer.append(".").append(currentVersion.getParts()[i]);
    }
    String noVersionProject = "<?xml version='1.0' encoding='UTF-8'?>\n" +
        "<wabit export-format=\"" + buffer.toString() + "\" wabit-app-version=\"0.9.9\">\n" +
        "<project name=\"aaaaa\">\n" +
        "</project>\n" +
        "</wabit>";
    
    ByteArrayInputStream in = new ByteArrayInputStream(noVersionProject.getBytes());
    
    SAXParser parser;
    WorkspaceSAXHandler saxHandler = new WorkspaceSAXHandler(context);

    try {
        parser = SAXParserFactory.newInstance().newSAXParser();
        parser.parse(in, saxHandler);
        fail("The file should not load if the file has a later major or minor version" +
                "than the currently supported version.");
    } catch (CancellationException e) {
        //do nothing on a cancellation
    }
}
 
开发者ID:SQLPower,项目名称:wabit,代码行数:35,代码来源:WorkspaceSAXHandlerTest.java

示例9: getPLSchemaVersion

import ca.sqlpower.util.Version; //导入依赖的package包/类
public Version getPLSchemaVersion() throws VersionFormatException {
    Version v = new Version(get("schema_version"));
    return v;
}
 
开发者ID:SQLPower,项目名称:sqlpower-library,代码行数:5,代码来源:DefaultParameters.java

示例10: getPLSchemaVersion

import ca.sqlpower.util.Version; //导入依赖的package包/类
public Version getPLSchemaVersion() {
    logger.debug("Stub call: StubMatchMakerSession.getPLSchemaVersion()");
    return null;
}
 
开发者ID:SQLPower,项目名称:power-matchmaker,代码行数:5,代码来源:StubMatchMakerSession.java

示例11: getPLSchemaVersion

import ca.sqlpower.util.Version; //导入依赖的package包/类
public Version getPLSchemaVersion() {
	throw new UnsupportedOperationException("Called getPLSchmaVersion on mock object");
}
 
开发者ID:SQLPower,项目名称:power-matchmaker,代码行数:4,代码来源:TestingMatchMakerSession.java

示例12: getPLSchemaVersion

import ca.sqlpower.util.Version; //导入依赖的package包/类
public Version getPLSchemaVersion() {
    throw new UnsupportedOperationException("Called getPLSchmaVersion on mock object");
}
 
开发者ID:SQLPower,项目名称:power-matchmaker,代码行数:4,代码来源:TestingMatchMakerHibernateSession.java

示例13: SPServerInfoPanel

import ca.sqlpower.util.Version; //导入依赖的package包/类
/**
* Create a {@link SPServerInfoPanel} populated with the given default
* settings
* 
* @param dialogOwner
*            The parent {@link Component} for the dialog containing this
*            {@link SPServerInfoPanel}
* @param clientVersion
*            The version of the client to be used to determine
*            compatibility with the server
* @param defaultSettings
*            A {@link SPServerInfo} instance set with the default
*            configuration
*/
  public SPServerInfoPanel(Component dialogOwner, Version clientVersion, SPServerInfo defaultSettings) {
      this.dialogOwner = dialogOwner;
      panel = buildUI(defaultSettings);
      defaultScheme = defaultSettings.getScheme();
      passwordAllowed = defaultSettings.isPasswordAllowed();
      this.clientVersion = clientVersion;
  }
 
开发者ID:SQLPower,项目名称:sqlpower-library,代码行数:22,代码来源:SPServerInfoPanel.java

示例14: getClientVersion

import ca.sqlpower.util.Version; //导入依赖的package包/类
/**
 * Gets the Version of the client that this {@link SPServerInfoManager} is
 * managing server instances for.
 * 
 * @return A {@link Version} containing the client version.
 */
public Version getClientVersion() {
	return clientVersion;
}
 
开发者ID:SQLPower,项目名称:sqlpower-library,代码行数:10,代码来源:SPServerInfoManager.java


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