本文整理汇总了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());
}
示例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());
}
示例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", "")));
}
}
}
示例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));
}
示例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));
}
示例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
}
}
示例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
}
}
示例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
}
}
示例9: getPLSchemaVersion
import ca.sqlpower.util.Version; //导入依赖的package包/类
public Version getPLSchemaVersion() throws VersionFormatException {
Version v = new Version(get("schema_version"));
return v;
}
示例10: getPLSchemaVersion
import ca.sqlpower.util.Version; //导入依赖的package包/类
public Version getPLSchemaVersion() {
logger.debug("Stub call: StubMatchMakerSession.getPLSchemaVersion()");
return null;
}
示例11: getPLSchemaVersion
import ca.sqlpower.util.Version; //导入依赖的package包/类
public Version getPLSchemaVersion() {
throw new UnsupportedOperationException("Called getPLSchmaVersion on mock object");
}
示例12: getPLSchemaVersion
import ca.sqlpower.util.Version; //导入依赖的package包/类
public Version getPLSchemaVersion() {
throw new UnsupportedOperationException("Called getPLSchmaVersion on mock object");
}
示例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;
}
示例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;
}