Skip to content

Commit

Permalink
Merge pull request #762 from 9tigerio/feature/761_fix_sql_templ_tests
Browse files Browse the repository at this point in the history
#761 - fix tests for oracle
  • Loading branch information
kdhrubo authored Nov 4, 2024
2 parents a139db0 + fb57ad0 commit 5ef782e
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ build/

### VS Code ###
.vscode/

## jte ##
/jte-classes/**
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@ public DataSource dataSource() {
private Map<Object, Object> buildDataSources() {
final Map<Object, Object> result = new HashMap<>();

if(Objects.isNull(databaseProperties.getDatabases())) {
log.info("*** No database configured.");
log.info("Databases - {}", databaseProperties.getDatabases());

if(databaseProperties.isRdbmsConfigured()) {
log.info("*** No RDBMS configured.");
return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,12 @@ void selectWithConditionalRenderJoin() throws Exception {
.param("language_id", String.valueOf(language_id))
.contentType(APPLICATION_JSON).accept(APPLICATION_JSON))
.andExpect(status().isOk())


.andExpect(jsonPath("$.*").isArray())
.andExpect(jsonPath("$.*", anyOf(hasSize(1))))
.andExpect(jsonPath("$[0].FILM_ID").value(film_id))
.andExpect(jsonPath("$[0].language_name").value("English"))
//.andExpect(jsonPath("$[0].LANGUAGE_NAME").value("English")) //TODO Fix
.andDo(document("ora-template-conditional-render-join"));
}
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
SELECT * FROM film;
SELECT * FROM film
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ public boolean isMongo() {
}

public boolean isJdbcPresent() {
return StringUtils.isNoneBlank(url);
return StringUtils.isNoneBlank(url)
&& !StringUtils.equalsIgnoreCase(url, "${DB_URL}");
}

public boolean includeAllSchemas() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@

import lombok.Data;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Objects;
import java.util.Optional;

@Data
@Component
@ConfigurationProperties(prefix = "app")
@Slf4j
public class DatabaseProperties {


Expand All @@ -23,4 +26,16 @@ public Optional<DatabaseConnectionDetail> getDatabase(String dbId) {
.filter(databaseConnectionDetail -> StringUtils.equalsIgnoreCase(dbId, databaseConnectionDetail.id()))
.findFirst();
}

public boolean isRdbmsConfigured() {
if(Objects.isNull(databases)) {
log.info("*** No RDBMS configured.");
return false;
}

return databases.stream()
.anyMatch(DatabaseConnectionDetail::isJdbcPresent);


}
}

0 comments on commit 5ef782e

Please sign in to comment.