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

#761 - fix tests for oracle #762

Merged
merged 2 commits into from
Nov 4, 2024
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
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);


}
}
Loading