@Test public void shouldUpdateItemsDefinitionHashForNewExtension() throws Exception { givenExtensionIsNotInRepository(EXTENSION_WITH_ITEMS_XML); FireflyExtensionModel fireflyExtensionModel = mockExtension(); given(fireflyExtensionRepository.create(EXTENSION_WITH_ITEMS_XML)).willReturn(fireflyExtensionModel); fireflyExtension.onUpdate(MIGRATION); verify(fireflyExtensionRepository).create(EXTENSION_WITH_ITEMS_XML); }
public void onUpdate(PK migration) { FireflyMigrationModel migrationModel = migrationRepository.findByPk(migration); FireflyExtensionModel fireflyExtensionModel = getOrCreateFireflyExtensionModel(); String itemsDefinitionHash = getItemsDefinitionHash(); String hmcDefinitionHash = getHmcDefinitionHash(); if (!equalsHash(getLastState(fireflyExtensionModel), itemsDefinitionHash, hmcDefinitionHash)) { createState(fireflyExtensionModel, migrationModel, itemsDefinitionHash, hmcDefinitionHash); } fireflyExtensionRepository.save(fireflyExtensionModel); }
FireflyExtension { public void onUpdate(PK migration) { FireflyMigrationModel migrationModel = migrationRepository.findByPk(migration); FireflyExtensionModel fireflyExtensionModel = getOrCreateFireflyExtensionModel(); String itemsDefinitionHash = getItemsDefinitionHash(); String hmcDefinitionHash = getHmcDefinitionHash(); if (!equalsHash(getLastState(fireflyExtensionModel), itemsDefinitionHash, hmcDefinitionHash)) { createState(fireflyExtensionModel, migrationModel, itemsDefinitionHash, hmcDefinitionHash); } fireflyExtensionRepository.save(fireflyExtensionModel); } }
FireflyExtension { public void onUpdate(PK migration) { FireflyMigrationModel migrationModel = migrationRepository.findByPk(migration); FireflyExtensionModel fireflyExtensionModel = getOrCreateFireflyExtensionModel(); String itemsDefinitionHash = getItemsDefinitionHash(); String hmcDefinitionHash = getHmcDefinitionHash(); if (!equalsHash(getLastState(fireflyExtensionModel), itemsDefinitionHash, hmcDefinitionHash)) { createState(fireflyExtensionModel, migrationModel, itemsDefinitionHash, hmcDefinitionHash); } fireflyExtensionRepository.save(fireflyExtensionModel); } FireflyExtension(String name, File rootPath, FireflyExtensionRepository fireflyExtensionRepository, MigrationRepository migrationRepository, boolean relaxedMode); }
FireflyExtension { public void onUpdate(PK migration) { FireflyMigrationModel migrationModel = migrationRepository.findByPk(migration); FireflyExtensionModel fireflyExtensionModel = getOrCreateFireflyExtensionModel(); String itemsDefinitionHash = getItemsDefinitionHash(); String hmcDefinitionHash = getHmcDefinitionHash(); if (!equalsHash(getLastState(fireflyExtensionModel), itemsDefinitionHash, hmcDefinitionHash)) { createState(fireflyExtensionModel, migrationModel, itemsDefinitionHash, hmcDefinitionHash); } fireflyExtensionRepository.save(fireflyExtensionModel); } FireflyExtension(String name, File rootPath, FireflyExtensionRepository fireflyExtensionRepository, MigrationRepository migrationRepository, boolean relaxedMode); boolean isUpdateRequired(); boolean isHmcResetRequired(); void onHmcReset(PK migration); void onUpdate(PK migration); @Override String toString(); }
FireflyExtension { public void onUpdate(PK migration) { FireflyMigrationModel migrationModel = migrationRepository.findByPk(migration); FireflyExtensionModel fireflyExtensionModel = getOrCreateFireflyExtensionModel(); String itemsDefinitionHash = getItemsDefinitionHash(); String hmcDefinitionHash = getHmcDefinitionHash(); if (!equalsHash(getLastState(fireflyExtensionModel), itemsDefinitionHash, hmcDefinitionHash)) { createState(fireflyExtensionModel, migrationModel, itemsDefinitionHash, hmcDefinitionHash); } fireflyExtensionRepository.save(fireflyExtensionModel); } FireflyExtension(String name, File rootPath, FireflyExtensionRepository fireflyExtensionRepository, MigrationRepository migrationRepository, boolean relaxedMode); boolean isUpdateRequired(); boolean isHmcResetRequired(); void onHmcReset(PK migration); void onUpdate(PK migration); @Override String toString();  }