Skip to main content
summaryrefslogtreecommitdiffstats
blob: 9ed8228c53ed8edd18d49bc2673c8766e7ea64b3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*******************************************************************************
 * Copyright (c) 2017 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.data;

import org.junit.Assert;
import org.junit.Test;

/**
 * Unit test for @link OseeCodeVersion
 *
 * @author Donald G. Dunne
 */
public class OseeCodeVersionTest {

   @Test
   public void test() {
      OseeCodeVersion.setVersion("RC_Development");
      OseeCodeVersion.setBundleVersion("0.25.2.v201801051909-NR");

      // NR-Alpha = 3
      Assert.assertEquals(25022018010519093L, OseeCodeVersion.computeVersionId().longValue());

      // NR-Beta = 2
      OseeCodeVersion.setVersion(OseeCodeVersion.getBundleVersion());
      Assert.assertEquals(25022018010519092L, OseeCodeVersion.computeVersionId().longValue());

      // Release = 1
      OseeCodeVersion.setBundleVersion("0.25.2.v201801051909-REL");
      OseeCodeVersion.setVersion(OseeCodeVersion.getBundleVersion());
      Assert.assertEquals(25022018010519091L, OseeCodeVersion.computeVersionId().longValue());

      // DEV-Alpha = 5
      OseeCodeVersion.setBundleVersion("0.25.2.v201801051909-DEV");
      OseeCodeVersion.setVersion("DEVELOPMENT");
      Assert.assertEquals(25022018010519095L, OseeCodeVersion.computeVersionId().longValue());

      // DEV-Beta = 4
      OseeCodeVersion.setVersion(OseeCodeVersion.getBundleVersion());
      Assert.assertEquals(25022018010519094L, OseeCodeVersion.computeVersionId().longValue());

      // Unknown = 0s
      OseeCodeVersion.setBundleVersion("0.25.2.v201801051909-XYZ");
      Assert.assertEquals(25022018010519090L, OseeCodeVersion.computeVersionId().longValue());

      // Invalid build pattern = 0
      OseeCodeVersion.setBundleVersion("025.2v201801051909-DEV");
      Assert.assertEquals(0L, OseeCodeVersion.computeVersionId().longValue());
   }

}

Back to the top