Remove Unused Files
Issue gh-1109
This commit is contained in:
@@ -1,199 +0,0 @@
|
||||
/*
|
||||
* Copyright 2005-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.ldap.itest.transaction.compensating.manager;
|
||||
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.ldap.core.DirContextAdapter;
|
||||
import org.springframework.ldap.core.DistinguishedName;
|
||||
import org.springframework.ldap.core.LdapTemplate;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Transactional
|
||||
public class LdapAndJdbcDummyDaoImpl implements DummyDao {
|
||||
|
||||
private LdapTemplate ldapTemplate;
|
||||
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
|
||||
this.jdbcTemplate = jdbcTemplate;
|
||||
}
|
||||
|
||||
public void setLdapTemplate(LdapTemplate ldapTemplate) {
|
||||
this.ldapTemplate = ldapTemplate;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.springframework.ldap.transaction.support.DummyDao#createWithException(java.lang
|
||||
* .String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
|
||||
*/
|
||||
public void createWithException(String country, String company, String fullname, String lastname,
|
||||
String description) {
|
||||
create(country, company, fullname, lastname, description);
|
||||
throw new DummyException("This method failed");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.springframework.ldap.transaction.support.DummyDao#create(java.lang.String,
|
||||
* java.lang.String, java.lang.String, java.lang.String, java.lang.String)
|
||||
*/
|
||||
public void create(String country, String company, String fullname, String lastname, String description) {
|
||||
DistinguishedName dn = new DistinguishedName();
|
||||
dn.add("ou", country);
|
||||
dn.add("ou", company);
|
||||
dn.add("cn", fullname);
|
||||
|
||||
DirContextAdapter ctx = new DirContextAdapter();
|
||||
ctx.setAttributeValues("objectclass", new String[] { "top", "person" });
|
||||
ctx.setAttributeValue("cn", fullname);
|
||||
ctx.setAttributeValue("sn", lastname);
|
||||
ctx.setAttributeValue("description", description);
|
||||
this.ldapTemplate.bind(dn, ctx, null);
|
||||
this.jdbcTemplate.update("insert into PERSON values(?, ?, ?)",
|
||||
new Object[] { fullname, lastname, description });
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.springframework.ldap.transaction.support.DummyDao#update(java.lang.String,
|
||||
* java.lang.String, java.lang.String)
|
||||
*/
|
||||
public void update(String dn, String fullname, String lastname, String description) {
|
||||
DirContextAdapter ctx = (DirContextAdapter) this.ldapTemplate.lookup(dn);
|
||||
ctx.setAttributeValue("sn", lastname);
|
||||
ctx.setAttributeValue("description", description);
|
||||
|
||||
this.ldapTemplate.modifyAttributes(ctx);
|
||||
this.jdbcTemplate.update("update PERSON set lastname=?, description = ? where fullname = ?",
|
||||
new Object[] { lastname, description, fullname });
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.springframework.ldap.transaction.support.DummyDao#updateWithException(java.lang
|
||||
* .String, java.lang.String, java.lang.String)
|
||||
*/
|
||||
public void updateWithException(String dn, String fullname, String lastname, String description) {
|
||||
update(dn, fullname, lastname, description);
|
||||
throw new DummyException("This method failed.");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.springframework.ldap.transaction.support.DummyDao#updateAndRename(java.lang.
|
||||
* String, java.lang.String, java.lang.String)
|
||||
*/
|
||||
public void updateAndRename(String dn, String newDn, String description) {
|
||||
DirContextAdapter ctx = (DirContextAdapter) this.ldapTemplate.lookup(dn);
|
||||
ctx.setAttributeValue("description", description);
|
||||
|
||||
this.ldapTemplate.modifyAttributes(ctx);
|
||||
this.ldapTemplate.rename(dn, newDn);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.springframework.ldap.transaction.support.DummyDao#updateAndRenameWithException(
|
||||
* java.lang.String, java.lang.String, java.lang.String)
|
||||
*/
|
||||
public void updateAndRenameWithException(String dn, String newDn, String description) {
|
||||
updateAndRename(dn, newDn, description);
|
||||
throw new DummyException("This method failed.");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.springframework.ldap.transaction.support.DummyDao#modifyAttributes(java.lang.
|
||||
* String, java.lang.String, java.lang.String)
|
||||
*/
|
||||
public void modifyAttributes(String dn, String lastName, String description) {
|
||||
DirContextAdapter ctx = (DirContextAdapter) this.ldapTemplate.lookup(dn);
|
||||
ctx.setAttributeValue("sn", lastName);
|
||||
ctx.setAttributeValue("description", description);
|
||||
|
||||
this.ldapTemplate.modifyAttributes(dn, ctx.getModificationItems());
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.springframework.ldap.transaction.support.DummyDao#modifyAttributesWithException
|
||||
* (java.lang.String, java.lang.String, java.lang.String)
|
||||
*/
|
||||
public void modifyAttributesWithException(String dn, String lastName, String description) {
|
||||
modifyAttributes(dn, lastName, description);
|
||||
throw new DummyException("This method failed.");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.springframework.ldap.transaction.support.DummyDao#unbind(java.lang.String)
|
||||
*/
|
||||
public void unbind(String dn, String fullname) {
|
||||
this.ldapTemplate.unbind(dn);
|
||||
this.jdbcTemplate.update("delete from PERSON where fullname=?", new Object[] { fullname });
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.springframework.ldap.transaction.support.DummyDao#unbindWithException(java.lang
|
||||
* .String)
|
||||
*/
|
||||
public void unbindWithException(String dn, String fullname) {
|
||||
unbind(dn, fullname);
|
||||
throw new DummyException("This operation failed.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRecursively(String dn) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRecursivelyWithException(String dn) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createRecursivelyAndUnbindSubnode() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createRecursivelyAndUnbindSubnodeWithException() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,152 +0,0 @@
|
||||
/*
|
||||
* Copyright 2005-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.ldap.itest.transaction.compensating.manager.hibernate;
|
||||
|
||||
/**
|
||||
* Pojo for use with the ContextSourceAndHibernateTransactionManager integration tests
|
||||
*
|
||||
* @author Hans Westerbeek
|
||||
*
|
||||
*/
|
||||
public class OrgPerson {
|
||||
|
||||
private Integer id;
|
||||
|
||||
private String fullname;
|
||||
|
||||
private String lastname;
|
||||
|
||||
private String company;
|
||||
|
||||
private String country;
|
||||
|
||||
private String description;
|
||||
|
||||
public Integer getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getFullname() {
|
||||
return this.fullname;
|
||||
}
|
||||
|
||||
public void setFullname(String fullname) {
|
||||
this.fullname = fullname;
|
||||
}
|
||||
|
||||
public String getLastname() {
|
||||
return this.lastname;
|
||||
}
|
||||
|
||||
public void setLastname(String lastname) {
|
||||
this.lastname = lastname;
|
||||
}
|
||||
|
||||
public String getCountry() {
|
||||
return this.country;
|
||||
}
|
||||
|
||||
public void setCountry(String country) {
|
||||
this.country = country;
|
||||
}
|
||||
|
||||
public String getCompany() {
|
||||
return this.company;
|
||||
}
|
||||
|
||||
public void setCompany(String company) {
|
||||
this.company = company;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final OrgPerson other = (OrgPerson) obj;
|
||||
if (this.company == null) {
|
||||
if (other.company != null) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (!this.company.equals(other.company)) {
|
||||
return false;
|
||||
}
|
||||
if (this.country == null) {
|
||||
if (other.country != null) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (!this.country.equals(other.country)) {
|
||||
return false;
|
||||
}
|
||||
if (this.description == null) {
|
||||
if (other.description != null) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (!this.description.equals(other.description)) {
|
||||
return false;
|
||||
}
|
||||
if (this.fullname == null) {
|
||||
if (other.fullname != null) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (!this.fullname.equals(other.fullname)) {
|
||||
return false;
|
||||
}
|
||||
if (this.lastname == null) {
|
||||
if (other.lastname != null) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (!this.lastname.equals(other.lastname)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((this.company == null) ? 0 : this.company.hashCode());
|
||||
result = prime * result + ((this.country == null) ? 0 : this.country.hashCode());
|
||||
result = prime * result + ((this.description == null) ? 0 : this.description.hashCode());
|
||||
result = prime * result + ((this.fullname == null) ? 0 : this.fullname.hashCode());
|
||||
result = prime * result + ((this.lastname == null) ? 0 : this.lastname.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright 2005-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.ldap.itest.transaction.compensating.manager.hibernate;
|
||||
|
||||
public interface OrgPersonDao {
|
||||
|
||||
void createWithException(OrgPerson person);
|
||||
|
||||
void create(OrgPerson person);
|
||||
|
||||
void update(OrgPerson person);
|
||||
|
||||
void updateWithException(OrgPerson person);
|
||||
|
||||
void updateAndRename(String dn, String newDn, String updatedDescription);
|
||||
|
||||
void updateAndRenameWithException(String dn, String newDn, String updatedDescription);
|
||||
|
||||
void modifyAttributes(String dn, String lastName, String description);
|
||||
|
||||
void modifyAttributesWithException(String dn, String lastName, String description);
|
||||
|
||||
void unbind(OrgPerson person);
|
||||
|
||||
void unbindWithException(OrgPerson person);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user