Skip to content

Commit

Permalink
Merge pull request #73 from bluesoft/bug/version_100
Browse files Browse the repository at this point in the history
Fix: Upgrade version above 100
  • Loading branch information
dcarneir authored Jan 11, 2023
2 parents fbc7933 + f1b4809 commit a5ef5a8
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.101] - 2023-01-11
### Fixed
- Upgrade on version above 100

## [1.100] - 2023-01-09
### Fixed
- Commit on markAll
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ mainClassName = "br.com.bluesoft.bee.Bee"

group = 'br.com.bluesoft.bee'
def artifact = 'bee'
version = '1.100'
version = '1.101'

def javaVersion = JavaVersion.VERSION_1_8
sourceCompatibility = javaVersion;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,16 @@ public class BeeUpgradeAction implements ActionRunner {
return version_latest
}

def static isLatestVersion() {
def version_current = Float.parseFloat(BeeVersionModule.getCurrentVersion())
def version_latest = Float.parseFloat(VERSION)
static int intVersion(String version) {
def parts = version.split("\\.")
return Integer.parseInt(parts[0]) * 1000 + Integer.parseInt(parts[1])
}

static boolean isLatestVersion() {
def version_current = intVersion(BeeVersionModule.getCurrentVersion())
def version_latest = intVersion(getLatestVersion())

return (version_latest <= version_current) ? true : false
return (version_latest <= version_current)
}

def static downloadLatestVersion() {
Expand Down
14 changes: 14 additions & 0 deletions src/test/groovy/br/com/bluesoft/bee/BeeUpgradeActionTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,20 @@ class BeeUpgradeActionTest extends Specification {
isLatest == false
}

def "deve validar versao maior que 100"() {
given: ""
GroovyMock(BeeVersionModule, global: true)
BeeVersionModule.getCurrentVersion() >> "1.99"
BeeVersionModule.getLatestVersion() >> "1.100"

when: ""
BeeUpgradeAction upgrade = new BeeUpgradeAction()
def isLatest = upgrade.isLatestVersion()

then: ""
isLatest == false
}

def "deve pegar a última versão e ela deve ser igual à versão retornada no módulo BeeVersionModule"() {
given: ""
def beeVersionLatest = BeeVersionModule.getLatestVersion()
Expand Down

0 comments on commit a5ef5a8

Please sign in to comment.