diff options
author | Roberto E. Escobar | 2015-01-15 22:49:09 +0000 |
---|---|---|
committer | Angel Avila | 2015-01-15 22:49:09 +0000 |
commit | 02908e6aa0efdfe5c5d7288a7e817a2be8bd4e8d (patch) | |
tree | 9dacb266c8813658add6ca4276e52940a71da80a | |
parent | 0b3a6efb33f4caee629df6cd255fb549bf538e8f (diff) | |
download | org.eclipse.osee-02908e6aa0efdfe5c5d7288a7e817a2be8bd4e8d.tar.gz org.eclipse.osee-02908e6aa0efdfe5c5d7288a7e817a2be8bd4e8d.tar.xz org.eclipse.osee-02908e6aa0efdfe5c5d7288a7e817a2be8bd4e8d.zip |
feature[ats_ATS152956]: Remove osee.build.designation from app server
Change-Id: I83d7d8f6e7165cd47844855af7ededd44492e055
15 files changed, 23 insertions, 633 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/ClientSessionManager.java b/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/ClientSessionManager.java index 22607ee6125..5f3468b0058 100644 --- a/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/ClientSessionManager.java +++ b/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/ClientSessionManager.java @@ -47,10 +47,6 @@ public class ClientSessionManager { return InternalClientSessionManager.getInstance().getOseeSession(); } - public static String getClientBuildDesignation() throws OseeAuthenticationRequiredException { - return getSessionGrant().getClientBuildDesignation(); - } - public static boolean isUserCreationRequired() throws OseeAuthenticationRequiredException { return getSessionGrant().isCreationRequired(); } diff --git a/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/internal/InternalClientSessionManager.java b/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/internal/InternalClientSessionManager.java index a9c8b707ff7..f4ef55d8600 100644 --- a/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/internal/InternalClientSessionManager.java +++ b/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/internal/InternalClientSessionManager.java @@ -124,8 +124,7 @@ public class InternalClientSessionManager { OseeLog.reportStatus(new BaseStatus(STATUS_ID, Level.SEVERE, ex)); OseeExceptions.wrapAndThrow(ex); } - OseeLog.reportStatus(new BaseStatus(STATUS_ID, Level.INFO, "%s BuildType:[%s]", oseeSession, - oseeSessionGrant.getClientBuildDesignation())); + OseeLog.reportStatus(new BaseStatus(STATUS_ID, Level.INFO, "%s", oseeSession)); } } diff --git a/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/internal/BuildTypeIdentifierTest.java b/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/internal/BuildTypeIdentifierTest.java deleted file mode 100644 index 08ad83598cf..00000000000 --- a/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/internal/BuildTypeIdentifierTest.java +++ /dev/null @@ -1,121 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.framework.core.server.test.internal; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import org.eclipse.osee.framework.core.server.internal.BuildInfo; -import org.eclipse.osee.framework.core.server.internal.BuildTypeIdentifier; -import org.eclipse.osee.framework.core.server.test.mocks.MockBuildTypeDataProvider; -import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; -import org.eclipse.osee.framework.jdk.core.util.Compare; -import org.eclipse.osee.framework.jdk.core.util.Lib; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameters; - -/** - * Test Case for {@link BuildTypeIdentifier} - * - * @author Roberto E. Escobar - */ -@RunWith(Parameterized.class) -public class BuildTypeIdentifierTest { - private static final String NULL_XML = null; - private static final String INVALID_XML = "Invalid<><>"; - private static final Collection<BuildInfo> EMPTY_INFOS = Collections.emptyList(); - private static final String XML_DATA1 = - "<builds><build type=\"BUILD1\"><matches>version1</matches></build></builds>"; - private static final Collection<BuildInfo> BUILD_DATA1 = Collections.singleton(new BuildInfo("BUILD1", "version1")); - - private static final String XML_DATA2 = - "<builds><build type=\"BUILD1\"><matches>version1.*</matches></build></builds>"; - private static final Collection<BuildInfo> BUILD_DATA2 = - Collections.singleton(new BuildInfo("BUILD1", "version1.*")); - - private static final String XML_DATA3 = - "<builds><build type=\"BUILD1\"><matches>ver[a|B].*?456</matches></build></builds>"; - private static final Collection<BuildInfo> BUILD_DATA3 = Collections.singleton(new BuildInfo("BUILD1", - "ver[a|B].*?456")); - - private static final String XML_DATA4 = - "<builds><build type=\"BUILD1\"><matches>0.9.1.*</matches></build><build type=\"BUILD2\"><matches>0.9.2.*</matches><matches>0.9.3.*</matches></build></builds>"; - private static final Collection<BuildInfo> BUILD_DATA4 = Arrays.asList(new BuildInfo("BUILD1", "0.9.1.*"), - new BuildInfo("BUILD2", "0.9.2.*", "0.9.3.*")); - - private static final String XML_DATA5 = - "<builds><build type=\"Release Candidate\"><matches>0.9.2.*</matches></build><build type=\"Release\"><matches>0.9.*</matches></build><build type=\"Hacking\"><matches>.*</matches></build></builds>"; - private static final Collection<BuildInfo> BUILD_DATA5 = Arrays.asList( - new BuildInfo("Release Candidate", "0.9.2.*"), new BuildInfo("Release", "0.9.*"), new BuildInfo("Hacking", ".*")); - - private final BuildTypeIdentifier buildIdentifier; - private final String clientVersion; - private final String expectedMatch; - private final String description; - private final boolean isError; - private final String xmlData; - private final Collection<BuildInfo> expectedInfos; - - public BuildTypeIdentifierTest(String description, String clientVersion, String expectedMatch, String xmlData, boolean isError, Collection<BuildInfo> expectedInfos) { - this.isError = isError; - this.xmlData = xmlData; - this.buildIdentifier = new BuildTypeIdentifier(new MockBuildTypeDataProvider(xmlData, isError)); - this.description = description; - this.clientVersion = clientVersion; - this.expectedMatch = expectedMatch; - this.expectedInfos = expectedInfos; - } - - @Test - public void testBuildType() { - Collection<BuildInfo> actualInfos = null; - try { - actualInfos = buildIdentifier.getBuildTypeEntries(); - if (isExceptionExpected()) { - Assert.fail("This line should not executed during an xml data access exception"); - } - } catch (OseeCoreException ex1) { - Assert.assertTrue("Threw exception when not expected. \n" + Lib.exceptionToString(ex1), isExceptionExpected()); - } - Assert.assertFalse(Compare.isDifferent(expectedInfos, actualInfos)); - } - - @Test - public void testBuildDesignation() { - String actualMatch = buildIdentifier.getBuildDesignation(clientVersion); - Assert.assertEquals(description, expectedMatch, actualMatch); - } - - private boolean isExceptionExpected() { - return isError || INVALID_XML.equals(xmlData); - } - - @Parameters - public static Collection<Object[]> data() { - List<Object[]> data = new ArrayList<Object[]>(); - - data.add(new Object[] {"null version && null xml data", null, "N/A", NULL_XML, false, EMPTY_INFOS}); - data.add(new Object[] {"valid versions && xml DataAccessException", "version1", "N/A", NULL_XML, true, null}); - data.add(new Object[] {"valid version && invalid xml data", "version1", "N/A", INVALID_XML, false, null}); - data.add(new Object[] {"exact match", "version1", "BUILD1", XML_DATA1, false, BUILD_DATA1}); - data.add(new Object[] {"regex match", "version12 !@#$da", "BUILD1", XML_DATA2, false, BUILD_DATA2}); - data.add(new Object[] {"complex regex match1", "verB!@#$_456", "BUILD1", XML_DATA3, false, BUILD_DATA3}); - data.add(new Object[] {"complex regex match2", "0.9.3.123132131", "BUILD2", XML_DATA4, false, BUILD_DATA4}); - data.add(new Object[] {"complex regex match3", "Development", "Hacking", XML_DATA5, false, BUILD_DATA5}); - return data; - } - -} diff --git a/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/internal/CoreServerInternalTestSuite.java b/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/internal/CoreServerInternalTestSuite.java index 298df377e1b..533fe64cbf2 100644 --- a/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/internal/CoreServerInternalTestSuite.java +++ b/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/internal/CoreServerInternalTestSuite.java @@ -15,10 +15,7 @@ import org.junit.runner.RunWith; import org.junit.runners.Suite; @RunWith(Suite.class) -@Suite.SuiteClasses({ // -BuildTypeIdentifierTest.class, // - SessionTestSuite.class, // -}) +@Suite.SuiteClasses({SessionTestSuite.class}) /** * @author Roberto E. Escobar */ diff --git a/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/internal/session/SessionFactoryTest.java b/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/internal/session/SessionFactoryTest.java index 0e9db8f9c09..f51718809b0 100644 --- a/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/internal/session/SessionFactoryTest.java +++ b/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/internal/session/SessionFactoryTest.java @@ -10,18 +10,21 @@ *******************************************************************************/ package org.eclipse.osee.framework.core.server.test.internal.session; +import static org.mockito.MockitoAnnotations.initMocks; import java.util.ArrayList; import java.util.Collection; import java.util.Date; import org.eclipse.osee.framework.core.server.internal.session.Session; import org.eclipse.osee.framework.core.server.internal.session.SessionFactory; -import org.eclipse.osee.framework.core.server.test.mocks.MockBuildTypeIdentifier; -import org.eclipse.osee.framework.core.server.test.mocks.MockLog; +import org.eclipse.osee.jdbc.JdbcService; +import org.eclipse.osee.logger.Log; import org.junit.Assert; +import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; +import org.mockito.Mock; /** * Test Case for {@link Session} @@ -31,6 +34,11 @@ import org.junit.runners.Parameterized.Parameters; @RunWith(Parameterized.class) public class SessionFactoryTest { + @Mock + private Log logger; + @Mock + private JdbcService jdbcService; + private final String guid; private final String userId; private final Date creationDate; @@ -38,8 +46,7 @@ public class SessionFactoryTest { private final String clientMachineName; private final String clientAddress; private final int clientPort; - private final MockBuildTypeIdentifier typeIdentifier = new MockBuildTypeIdentifier(); - private final SessionFactory factory = new SessionFactory(new MockLog(), null, typeIdentifier); + private final SessionFactory factory; public SessionFactoryTest(String guid, String userId, Date creationDate, String clientVersion, String clientMachineName, String clientAddress, int clientPort) { super(); @@ -50,6 +57,12 @@ public class SessionFactoryTest { this.clientMachineName = clientMachineName; this.clientAddress = clientAddress; this.clientPort = clientPort; + this.factory = new SessionFactory(logger, jdbcService); + } + + @Before + public void setup() { + initMocks(this); } @Test diff --git a/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/mocks/MockBuildTypeDataProvider.java b/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/mocks/MockBuildTypeDataProvider.java deleted file mode 100644 index 4f819546d7a..00000000000 --- a/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/mocks/MockBuildTypeDataProvider.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.framework.core.server.test.mocks; - -import org.eclipse.osee.framework.core.server.internal.BuildTypeIdentifier.BuildTypeDataProvider; -import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; - -/** - * @author Roberto E. Escobar - */ -public class MockBuildTypeDataProvider implements BuildTypeDataProvider { - - private final String data; - private final boolean isErrorOnGet; - - public MockBuildTypeDataProvider(String data, boolean isErrorOnGet) { - this.data = data; - this.isErrorOnGet = isErrorOnGet; - } - - @Override - public String getData() { - if (isErrorOnGet) { - throw new OseeCoreException("Error case set"); - } - return data; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/mocks/MockBuildTypeIdentifier.java b/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/mocks/MockBuildTypeIdentifier.java deleted file mode 100644 index 00b7ada080f..00000000000 --- a/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/mocks/MockBuildTypeIdentifier.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.framework.core.server.test.mocks; - -import org.eclipse.osee.framework.core.server.internal.BuildTypeIdentifier; - -/** - * @author Roberto E. Escobar - */ -public class MockBuildTypeIdentifier extends BuildTypeIdentifier { - - private String clientVersion; - private String designation; - - public MockBuildTypeIdentifier() { - super(null); - } - - @Override - public String getBuildDesignation(String clientVersion) { - this.clientVersion = clientVersion; - return designation; - } - - public String getClientVersion() { - return clientVersion; - } - - public void setDesignation(String designation) { - this.designation = designation; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/mocks/MockLog.java b/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/mocks/MockLog.java deleted file mode 100644 index 7521956dc86..00000000000 --- a/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/mocks/MockLog.java +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.framework.core.server.test.mocks; - -import org.eclipse.osee.logger.Log; - -/** - * @author Andrew M. Finkbeiner - */ -public class MockLog implements Log { - - @Override - public boolean isTraceEnabled() { - return true; - } - - @Override - public void trace(String format, Object... args) { - commonOut(format, args); - } - - @Override - public void trace(Throwable th, String format, Object... args) { - commonOut(format, args); - } - - @Override - public boolean isDebugEnabled() { - return true; - } - - @Override - public void debug(String format, Object... args) { - commonOut(format, args); - } - - @Override - public void debug(Throwable th, String format, Object... args) { - commonOut(th, format, args); - } - - @Override - public boolean isInfoEnabled() { - return true; - } - - @Override - public void info(String format, Object... args) { - commonOut(format, args); - } - - @Override - public void info(Throwable th, String format, Object... args) { - commonOut(th, format, args); - } - - @Override - public boolean isWarnEnabled() { - return true; - } - - @Override - public void warn(String format, Object... args) { - commonOut(format, args); - } - - @Override - public void warn(Throwable th, String format, Object... args) { - commonOut(th, format, args); - } - - @Override - public boolean isErrorEnabled() { - return true; - } - - @Override - public void error(String format, Object... args) { - commonOut(format, args); - } - - @Override - public void error(Throwable th, String format, Object... args) { - commonOut(th, format, args); - } - - private void commonOut(String format, Object... args) { - System.out.printf(format, args); - System.out.println(); - } - - private void commonOut(Throwable th, String format, Object... args) { - commonOut(format, args); - th.printStackTrace(); - } - -} diff --git a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/BuildInfo.java b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/BuildInfo.java deleted file mode 100644 index f338a9a5345..00000000000 --- a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/BuildInfo.java +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.framework.core.server.internal; - -import java.util.HashSet; -import java.util.Set; - -/** - * @author Roberto E. Escobar - */ -public final class BuildInfo { - private final String typeName; - private final Set<String> versionPattern; - - public BuildInfo(String typeName, String... patterns) { - this.typeName = typeName; - this.versionPattern = new HashSet<String>(); - - if (patterns != null && patterns.length > 0) { - for (String pattern : patterns) { - addPattern(pattern); - } - } - } - - public void addPattern(String version) { - versionPattern.add(version); - } - - public String getName() { - return typeName; - } - - public String[] getVersions() { - return versionPattern.toArray(new String[versionPattern.size()]); - } - - @Override - public String toString() { - return String.format("Build:[%s] Patterns:%s", getName(), versionPattern); - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + (typeName == null ? 0 : typeName.hashCode()); - result = prime * result + (versionPattern == null ? 0 : versionPattern.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - BuildInfo other = (BuildInfo) obj; - if (typeName == null) { - if (other.typeName != null) { - return false; - } - } else if (!typeName.equals(other.typeName)) { - return false; - } - if (versionPattern == null) { - if (other.versionPattern != null) { - return false; - } - } else if (!versionPattern.equals(other.versionPattern)) { - return false; - } - return true; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/BuildTypeIdentifier.java b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/BuildTypeIdentifier.java deleted file mode 100644 index dde73089dde..00000000000 --- a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/BuildTypeIdentifier.java +++ /dev/null @@ -1,171 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.framework.core.server.internal; - -import java.io.Reader; -import java.io.StringReader; -import java.util.ArrayList; -import java.util.Collection; -import java.util.regex.PatternSyntaxException; -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamConstants; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import org.eclipse.osee.framework.core.exception.OseeExceptions; -import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; -import org.eclipse.osee.framework.jdk.core.util.Lib; -import org.eclipse.osee.framework.jdk.core.util.Strings; - -/** - * @author Roberto E. Escobar - */ -public class BuildTypeIdentifier { - - public static interface BuildTypeDataProvider { - - String getData(); - } - - private static final String DEFAULT_IDENTIFIER = "N/A"; - private static final String START_TAG = "build"; - private static final String ID_TAG = "type"; - private static final String ENTRY_TAG = "matches"; - - private final BuildTypeDataProvider provider; - - public BuildTypeIdentifier(BuildTypeDataProvider provider) { - this.provider = provider; - } - - public String getBuildDesignation(String clientVersion) { - BuildInfo buildType = null; - try { - buildType = match(clientVersion, getBuildTypeEntries()); - } catch (OseeCoreException ex) { - // Do Nothing - - } - return buildType != null ? buildType.getName() : DEFAULT_IDENTIFIER; - } - - public synchronized Collection<BuildInfo> getBuildTypeEntries() throws OseeCoreException { - Collection<BuildInfo> dataEntries = new ArrayList<BuildInfo>(); - String rawData = provider.getData(); - BuildTypeParser parser = new BuildTypeParser(); - parser.load(rawData, dataEntries); - return dataEntries; - } - - private static BuildInfo match(String version, Collection<BuildInfo> dataEntries) { - BuildInfo toReturn = null; - if (Strings.isValid(version)) { - for (BuildInfo entry : dataEntries) { - for (String regEx : entry.getVersions()) { - if (Strings.isValid(regEx)) { - try { - if (isCompatibleVersion(regEx, version)) { - toReturn = entry; - } - } catch (PatternSyntaxException ex) { - // Do Nothing - - } - } - } - } - } - return toReturn; - } - - private static boolean isCompatibleVersion(String serverVersion, String clientVersion) throws PatternSyntaxException { - boolean result = false; - if (serverVersion.equals(clientVersion)) { - result = true; - } else { - result = clientVersion.matches(serverVersion); - if (!result) { - result = serverVersion.matches(clientVersion); - } - } - return result; - } - - private static final class BuildTypeParser { - private static final XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance(); - private BuildInfo currentType; - private String localName; - private String uri; - private boolean isVersionPattern; - - public BuildTypeParser() { - reset(); - } - - public void reset() { - localName = null; - uri = null; - currentType = null; - isVersionPattern = false; - } - - private void load(String rawData, Collection<BuildInfo> dataEntries) throws OseeCoreException { - if (Strings.isValid(rawData)) { - Reader reader = new StringReader(rawData); - try { - XMLStreamReader streamReader = xmlInputFactory.createXMLStreamReader(reader); - while (streamReader.hasNext()) { - process(streamReader, dataEntries); - streamReader.next(); - } - } catch (XMLStreamException ex) { - OseeExceptions.wrapAndThrow(ex); - } finally { - Lib.close(reader); - } - } - } - - private void process(XMLStreamReader reader, Collection<BuildInfo> dataEntries) { - int eventType = reader.getEventType(); - switch (eventType) { - case XMLStreamConstants.START_ELEMENT: - localName = reader.getLocalName(); - uri = reader.getNamespaceURI(); - if (START_TAG.equals(localName)) { - String typeName = reader.getAttributeValue(uri, ID_TAG); - if (Strings.isValid(typeName)) { - currentType = new BuildInfo(typeName); - } - } else if (ENTRY_TAG.equals(localName) && currentType != null) { - isVersionPattern = true; - } - break; - case XMLStreamConstants.CDATA: - case XMLStreamConstants.CHARACTERS: - if (isVersionPattern) { - String data = reader.getText(); - if (Strings.isValid(data)) { - currentType.addPattern(data); - } - } - break; - case XMLStreamConstants.END_ELEMENT: - localName = reader.getLocalName(); - uri = reader.getNamespaceURI(); - if (START_TAG.equals(localName) && currentType != null) { - dataEntries.add(currentType); - reset(); - } else if (ENTRY_TAG.equals(localName) && currentType != null) { - isVersionPattern = false; - } - break; - } - } - } -} diff --git a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionFactory.java b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionFactory.java index 29dd3354d5c..798c196c592 100644 --- a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionFactory.java +++ b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionFactory.java @@ -18,7 +18,6 @@ import org.eclipse.osee.framework.core.data.IUserToken; import org.eclipse.osee.framework.core.data.OseeSessionGrant; import org.eclipse.osee.framework.core.model.cache.IOseeTypeFactory; import org.eclipse.osee.framework.core.server.OseeServerProperties; -import org.eclipse.osee.framework.core.server.internal.BuildTypeIdentifier; import org.eclipse.osee.framework.core.server.internal.util.OseeSql; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.Conditions; @@ -33,12 +32,10 @@ import org.eclipse.osee.logger.Log; * @author Roberto E. Escobar */ public final class SessionFactory implements IOseeTypeFactory { - private final BuildTypeIdentifier typeIdentifier; private final Log logger; private final JdbcService jdbcService; - public SessionFactory(Log logger, JdbcService jdbcService, BuildTypeIdentifier typeIdentifier) { - this.typeIdentifier = typeIdentifier; + public SessionFactory(Log logger, JdbcService jdbcService) { this.logger = logger; this.jdbcService = jdbcService; } @@ -69,7 +66,6 @@ public final class SessionFactory implements IOseeTypeFactory { sessionGrant.setSqlProperties(properties); sessionGrant.setDataStorePath(OseeServerProperties.getOseeApplicationServerData(logger)); - sessionGrant.setClientBuildDesination(typeIdentifier.getBuildDesignation(session.getClientVersion())); return sessionGrant; } diff --git a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionManagerService.java b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionManagerService.java index a980bb29e34..a7b2320af40 100644 --- a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionManagerService.java +++ b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionManagerService.java @@ -20,9 +20,6 @@ import org.eclipse.osee.framework.core.exception.OseeExceptions; import org.eclipse.osee.framework.core.server.IAuthenticationManager; import org.eclipse.osee.framework.core.server.ISession; import org.eclipse.osee.framework.core.server.ISessionManager; -import org.eclipse.osee.framework.core.server.internal.BuildTypeIdentifier; -import org.eclipse.osee.framework.core.server.internal.BuildTypeIdentifier.BuildTypeDataProvider; -import org.eclipse.osee.framework.core.server.internal.util.OseeInfo; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.jdbc.JdbcClient; import org.eclipse.osee.jdbc.JdbcService; @@ -33,8 +30,6 @@ import org.eclipse.osee.logger.Log; */ public final class SessionManagerService implements ISessionManager { - private static final String BUILD_DATA_KEY = "osee.build.designation"; - private Log logger; private JdbcService jdbcService; private IAuthenticationManager authenticationManager; @@ -60,16 +55,7 @@ public final class SessionManagerService implements ISessionManager { public void start() throws OseeCoreException { final JdbcClient jdbcClient = jdbcService.getClient(); - BuildTypeIdentifier identifier = new BuildTypeIdentifier(new BuildTypeDataProvider() { - - @Override - public String getData() { - return OseeInfo.getValue(jdbcClient, BUILD_DATA_KEY); - } - - }); - - SessionFactory sessionFactory = new SessionFactory(logger, jdbcService, identifier); + SessionFactory sessionFactory = new SessionFactory(logger, jdbcService); ISessionQuery sessionQuery = new DatabaseSessionQuery(jdbcClient); DatabaseSessionAccessor accessor = new DatabaseSessionAccessor(sessionFactory, sessionQuery, jdbcClient); diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeSessionGrant.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeSessionGrant.java index c47db67d0f9..ed0fd2bb07c 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeSessionGrant.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeSessionGrant.java @@ -39,7 +39,6 @@ public class OseeSessionGrant extends BaseExchangeData { private static final String OSEE_USER_ID = "oseeUserId"; private static final String OSEE_IS_USER_ACTIVE = "isOseeUserActive"; private static final String OSEE_APPLICATION_SERVER_DATA_PATH = "oseeApplicationServerDataPath"; - private static final String OSEE_CLIENT_BUILD_DESIGNATION = "oseeClientBuildDesignation"; private static final String AUTHENTICATION_PROTOCOL = "oseeAuthenticationProtocol"; private IDatabaseInfo grantedDatabaseInfo; @@ -108,14 +107,6 @@ public class OseeSessionGrant extends BaseExchangeData { return getGrantedUserToken(); } - public String getClientBuildDesignation() { - return getString(OSEE_CLIENT_BUILD_DESIGNATION); - } - - public void setClientBuildDesination(String designation) { - this.backingData.put(OSEE_CLIENT_BUILD_DESIGNATION, designation); - } - public String getAuthenticationProtocol() { return getString(AUTHENTICATION_PROTOCOL); } diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/OseeBuildTypeContributionItem.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/OseeBuildTypeContributionItem.java index ba99c5e0d79..4d141d04214 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/OseeBuildTypeContributionItem.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/OseeBuildTypeContributionItem.java @@ -25,7 +25,7 @@ public class OseeBuildTypeContributionItem extends OseeStatusContributionItem { private static final String ID = "osee.build.type"; - private static String TOOLTIP = "Version [%s]\nBuild Type[%s]\nDouble-Click for details"; + private static String TOOLTIP = "Version [%s]\nDouble-Click for details"; public OseeBuildTypeContributionItem() { super(ID); @@ -50,17 +50,7 @@ public class OseeBuildTypeContributionItem extends OseeStatusContributionItem { @Override protected String getEnabledToolTip() { - return String.format(TOOLTIP, getClientVersion(), getBuildDesignation()); - } - - private String getBuildDesignation() { - String designation = "N/A"; - try { - designation = ClientSessionManager.getClientBuildDesignation(); - } catch (OseeCoreException ex) { - // Do Nothing - } - return designation; + return String.format(TOOLTIP, getClientVersion()); } private String getClientVersion() { diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/ConfigurationDetails.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/ConfigurationDetails.java index 3851de737a7..70c244e15ea 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/ConfigurationDetails.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/ConfigurationDetails.java @@ -13,10 +13,8 @@ package org.eclipse.osee.framework.ui.skynet.preferences; import java.util.logging.Level; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.PreferencePage; -import org.eclipse.osee.framework.core.client.ClientSessionManager; import org.eclipse.osee.framework.core.client.OseeClientProperties; import org.eclipse.osee.framework.core.data.OseeCodeVersion; -import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.AHTML; import org.eclipse.osee.framework.logging.IHealthStatus; import org.eclipse.osee.framework.logging.OseeLog; @@ -103,17 +101,6 @@ public class ConfigurationDetails extends PreferencePage implements IWorkbenchPr builder.append("<table class=\"oseeTable\" width=\"100%\">"); builder.append(AHTML.addHeaderRowMultiColumnTable(new String[] {"Type", "Info", "Status"})); - String buildType = "N/A"; - boolean wasSuccessful = false; - try { - buildType = ClientSessionManager.getClientBuildDesignation(); - wasSuccessful = true; - } catch (OseeCoreException ex) { - // Do Nothing; - } catch (NullPointerException ex) { - OseeLog.log(Activator.class, Level.SEVERE, ex); - } - try { builder.append("<tr><td><b>OSEE Client Installation</b></td><td colspan=2>" + System.getProperty("user.dir") + "</td></tr>"); } catch (NullPointerException ex) { @@ -135,9 +122,6 @@ public class ConfigurationDetails extends PreferencePage implements IWorkbenchPr OseeLog.log(Activator.class, Level.SEVERE, ex); } - builder.append(AHTML.addRowMultiColumnTable("<b>OSEE Client Build Type</b>", buildType, - wasSuccessful ? "<font color=\"green\"><b>Ok</b></font>" : "<font color=\"red\"><b>Unavailable</b></font>")); - try { for (IHealthStatus status : OseeLog.getStatus()) { builder.append(AHTML.addRowMultiColumnTable( |