use of org.jooq.DSLContext in project waltz by khartec.
the class SoftwareCatalogHarness method main.
public static void main(String[] args) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
SoftwareCatalogService softwareCatalogService = ctx.getBean(SoftwareCatalogService.class);
DSLContext dsl = ctx.getBean(DSLContext.class);
EntityReference ref = ImmutableEntityReference.builder().kind(EntityKind.ORG_UNIT).id(20L).build();
IdSelectionOptions options = ImmutableIdSelectionOptions.builder().entityReference(ref).scope(HierarchyQueryScope.CHILDREN).build();
SoftwareSummaryStatistics stats = softwareCatalogService.findStatisticsForAppIdSelector(options);
System.out.println("stats:" + stats);
}
use of org.jooq.DSLContext in project waltz by khartec.
the class SpecificationHarness method main.
public static void main(String[] args) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
DSLContext dsl = ctx.getBean(DSLContext.class);
PhysicalSpecificationDao physicalSpecificationDao = ctx.getBean(PhysicalSpecificationDao.class);
}
use of org.jooq.DSLContext in project waltz by khartec.
the class UserHarness method main.
public static void main(String[] args) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
UserRoleService userRoleService = ctx.getBean(UserRoleService.class);
DSLContext dsl = ctx.getBean(DSLContext.class);
int rc = dsl.insertInto(USER).set(USER.USER_NAME, "kamran").set(USER.PASSWORD, "1234").onDuplicateKeyIgnore().execute();
System.out.println(rc);
//
// ImmutableLoginRequest loginRequest = ImmutableLoginRequest.builder()
// .userName("dwatkins")
// .password("wrong")
// .build();
//
// boolean authenticated = userService.authenticate(loginRequest);
// System.out.println(authenticated);
//
// userRoleService.findAllUsers().forEach(System.out::println);
}
use of org.jooq.DSLContext in project waltz by khartec.
the class AppGenerator method main.
public static void main(String[] args) throws IOException {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
DSLContext dsl = ctx.getBean(DSLContext.class);
ApplicationService applicationDao = ctx.getBean(ApplicationService.class);
OrganisationalUnitService ouDao = ctx.getBean(OrganisationalUnitService.class);
List<String> animals = IOUtilities.readLines(AppGenerator.class.getClassLoader().getResourceAsStream("animals.txt"));
OrganisationalUnit[] organisationalUnits = ouDao.findAll().toArray(new OrganisationalUnit[0]);
List<AppRegistrationRequest> registrationRequests = new ArrayList<>();
for (int i = 0; i < 5000; i++) {
String animal = randomPick(animals.toArray(new String[0])) + " - " + i;
OrganisationalUnit organisationalUnit = randomPick(organisationalUnits);
LifecyclePhase phase = rnd.nextInt(10) > 7 ? randomPick(LifecyclePhase.values()) : LifecyclePhase.PRODUCTION;
Criticality businessCriticality = rnd.nextInt(10) > 7 ? randomPick(Criticality.values()) : Criticality.HIGH;
AppRegistrationRequest app = ImmutableAppRegistrationRequest.builder().name(animal).assetCode("wltz-0" + i).description("All about " + animal).applicationKind(randomPick(ApplicationKind.values())).lifecyclePhase(phase).overallRating(randomPick(RagRating.R, RagRating.A, RagRating.A, RagRating.G, RagRating.G)).organisationalUnitId(organisationalUnit.id().get()).businessCriticality(businessCriticality).build();
registrationRequests.add(app);
}
dsl.deleteFrom(AUTHORITATIVE_SOURCE).execute();
dsl.deleteFrom(APPLICATION).execute();
registrationRequests.forEach(a -> applicationDao.registerApp(a, "admin"));
}
use of org.jooq.DSLContext in project waltz by khartec.
the class AssetCostGenerator method main.
public static void main(String[] args) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
ApplicationService applicationService = ctx.getBean(ApplicationService.class);
DSLContext dsl = ctx.getBean(DSLContext.class);
List<AssetCostRecord> appDevCosts = generateRecords(applicationService, "APPLICATION_DEVELOPMENT", 100_0000);
List<AssetCostRecord> infraCosts = generateRecords(applicationService, "INFRASTRUCTURE", 5_000);
dsl.deleteFrom(ASSET_COST).where(ASSET_COST.YEAR.eq(year)).and(ASSET_COST.PROVENANCE.eq(provenance)).execute();
dsl.batchInsert(appDevCosts).execute();
dsl.batchInsert(infraCosts).execute();
}
Aggregations