/// @brief Creates or updates a server.
///
/// @param server Instance of the server to be stored.
+ /// @throw InvalidOperation when trying to create a duplicate or
+ /// update the logical server 'all'.
virtual void
createUpdateServer4(const db::ServerPtr& server);
/// @brief Creates or updates a server.
///
/// @param server Instance of the server to be stored.
+ /// @throw InvalidOperation when trying to create a duplicate or
+ /// update the logical server 'all'.
virtual void
createUpdateServer6(const db::ServerPtr& server);
const int& create_index,
const int& update_index,
const ServerPtr& server) {
+ // The server tag 'all' is reserved.
+ if (server->getServerTag().amAll()) {
+ isc_throw(InvalidOperation, "'all' is a name reserved for the server tag which"
+ " associates the configuration elements with all servers connecting"
+ " to the database and a server with this name can't be created");
+ }
+
// Create scoped audit revision. As long as this instance exists
// no new audit revisions are created in any subsequent calls.
ScopedAuditRevision audit_revision(this,
/// @param create_index Index of the INSERT query to be used.
/// @param update_index Index of the UPDATE query to be used.
/// @param server Pointer to the server to be inserted or updated.
+ /// @throw InvalidOperation when trying to create a duplicate or
+ /// update the logical server 'all'.
void createUpdateServer(const int& create_audit_revision,
const int& create_index,
const int& update_index,
"server set");
}
+ // It should not be possible to create a duplicate of the logical
+ // server 'all'.
+ auto all_server = Server::create(ServerTag("all"), "this is logical server all");
+ EXPECT_THROW(cbptr_->createUpdateServer4(all_server), isc::InvalidOperation);
+
ServerPtr returned_server;
// An attempt to fetch the server that hasn't been inserted should return
"server set");
}
+ // It should not be possible to create a duplicate of the logical
+ // server 'all'.
+ auto all_server = Server::create(ServerTag("all"), "this is logical server all");
+ EXPECT_THROW(cbptr_->createUpdateServer6(all_server), isc::InvalidOperation);
+
ServerPtr returned_server;
// An attempt to fetch the server that hasn't been inserted should return