Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Upgrade version above 100 #73

Merged
merged 1 commit into from
Jan 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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